Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
metamod:user_database_revised [2010-08-27 08:43:00] egils |
metamod:user_database_revised [2022-05-31 09:29:32] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== User database revised ====== | ====== User database revised ====== | ||
- | **Contains | + | Contains changes to the User database design and API that are needed for subscription information and possibly other needs. |
- | + | ||
- | ===== Overview ===== | + | |
- | {{: | + | |
- | + | ||
- | ===== Design ===== | + | |
+ | 2010-09-13: Changes due to the introduction of a U_loginname field. | ||
+ | 2010-09-14: Names of various methods are changed. | ||
+ | **2010-09-24: | ||
+ | **2010-09-28: | ||
+ | 2010-11-11: Removed WMS_URL and WMS_XML entries from the InfoDS table | ||
+ | ===== Overview ===== | ||
+ | {{: | ||
+ | ===== Design ===== | ||
Line 18: | Line 21: | ||
**UserTable** | **UserTable** | ||
- | |__U_id__ |A_id |U_name |U_email |U_password |U_institution |U_telephone |U_session | | + | |__U_id__ |A_id |U_name |U_email |
**DataSet** | **DataSet** | ||
Line 26: | Line 29: | ||
**InfoDS** | **InfoDS** | ||
- | |**__I_id__** |DS_id |I_type |I_content | | + | |__I_id__ |DS_id |I_type |I_content | |
**InfoUDS** | **InfoUDS** | ||
- | |**__I_id__** |**U_id** |**DS_id** |**I_type** |**I_content** | | + | |__I_id__ |U_id |DS_id |I_type |I_content | |
**File** | **File** | ||
- | |__DS_id__ | + | |__U_id__ |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
Line 48: | Line 44: | ||
The table details are presented below: | The table details are presented below: | ||
- | |||
- | |||
- | |||
- | |||
Line 60: | Line 52: | ||
^U_name |User name as given in registration form | | ^U_name |User name as given in registration form | | ||
^U_email |User E-mail address as given in registration form | | ^U_email |User E-mail address as given in registration form | | ||
+ | ^U_loginname |Login name for user authentication | | ||
^U_password |User password | | ^U_password |User password | | ||
^U_institution |User institution acronym as given in registration form | | ^U_institution |User institution acronym as given in registration form | | ||
Line 68: | Line 61: | ||
The A_id field connects the user to one of the METAMOD applications that share the same database. If the same person wants to be a user of more than one of these METAMOD applications, | The A_id field connects the user to one of the METAMOD applications that share the same database. If the same person wants to be a user of more than one of these METAMOD applications, | ||
- | |||
- | |||
- | |||
Line 81: | Line 71: | ||
The combination of the '' | The combination of the '' | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
==== InfoDS ==== | ==== InfoDS ==== | ||
- | **This table is used to contain various information connected to a dataset. Each row has a serial unique identifier (I_id). The row is connected to a dataset through the DS_id foreign key.** | + | This table is used to contain various information connected to a dataset. Each row has a serial unique identifier (I_id). The row is connected to a dataset through the DS_id foreign key. |
A type tag (I_type) field tells what kind of information is contained in the row. The value is a short acronym for a limited set of information types. The piece of information is found in the I_content text field. | A type tag (I_type) field tells what kind of information is contained in the row. The value is a short acronym for a limited set of information types. The piece of information is found in the I_content text field. | ||
- | ^**I_id** |**Unique id (autoincremented number). Primary key** | | + | ^I_id |Unique id (autoincremented number). Primary key | |
^DS_id |Identifiles a dataset this info-row is connected to. | | ^DS_id |Identifiles a dataset this info-row is connected to. | | ||
^I_type |Type tag. Short acronym that identifies the information type. | | ^I_type |Type tag. Short acronym that identifies the information type. | | ||
Line 117: | Line 90: | ||
^LOCATION |Location. Single entity. Absolute path to the directory under which all files belonging to the dataset are found. The files may be found directly in the location directory, or in any subdirectory of the location directory at any level. | | ^LOCATION |Location. Single entity. Absolute path to the directory under which all files belonging to the dataset are found. The files may be found directly in the location directory, or in any subdirectory of the location directory at any level. | | ||
^CATALOG |Partial URL to a THREDDS dataset. Single entity. Combined with the file name, this URL can be used to access the content of a file through a TDS server. It can also provide the URL that points to the THREDDS catalog containing the METAMOD dataset. | | ^CATALOG |Partial URL to a THREDDS dataset. Single entity. Combined with the file name, this URL can be used to access the content of a file through a TDS server. It can also provide the URL that points to the THREDDS catalog containing the METAMOD dataset. | | ||
- | ^WMS_URL |URL to the WMS service that can display data from the dataset. Single entity. | | ||
- | ^WMS_XML |XML document that describes available alternatives for displaying the dataset in WMS. For example, the parameters that can be displayed. Each parameter may have a palette (for example “BOXFILL/ | ||
|Additional information types may be added later, for example to implement projection information: | |Additional information types may be added later, for example to implement projection information: | ||
^PROJECTION_XML |XML document used to represent reprojection information. The document contains, among other things, each projection the user has asked for (" | ^PROJECTION_XML |XML document used to represent reprojection information. The document contains, among other things, each projection the user has asked for (" | ||
Line 124: | Line 95: | ||
==== InfoUDS ==== | ==== InfoUDS ==== | ||
- | **This table is used to express relationships between a dataset and a user. Each row has a serial unique identifier (I_id). The row is connected to a dataset through the DS_id foreign key, and to a user through the U_id foreign key.** | + | This table is used to express relationships between a dataset and a user. Each row has a serial unique identifier (I_id). The row is connected to a dataset through the DS_id foreign key, and to a user through the U_id foreign key. |
- | **A type tag (I_type) field tells what kind of information is contained in the row. The value is a short acronym for a limited set of information types. The piece of information is found in the I_content text field.** | + | A type tag (I_type) field tells what kind of information is contained in the row. The value is a short acronym for a limited set of information types. The piece of information is found in the I_content text field. |
- | ^I_id |**Unique id (autoincremented number). Primary key** | | + | ^I_id |Unique id (autoincremented number). Primary key | |
- | ^U_id |**Identifiles a user this row is connected to.** | | + | ^U_id |Identifiles a user this row is connected to. | |
- | ^DS_id |**Identifiles a dataset this info-row is connected to.** | | + | ^DS_id |Identifiles a dataset this info-row is connected to. | |
- | ^I_type |**Type tag. Short acronym that identifies the information type.** | | + | ^I_type |Type tag. Short acronym that identifies the information type. | |
- | ^I_content |**The text string representing a piece of information. This can be a single entity (unstructured text) or an XML document.** | | + | ^I_content |The text string representing a piece of information. This can be a single entity (unstructured text) or an XML document. | |
- | **For the time being, the following information types (I_type) will be needed.** | + | For the time being, the following information types (I_type) will be needed. |
^Type ^Description ^ | ^Type ^Description ^ | ||
- | ^SUBSCRIPTION_XML |**XML describing details of a subscription on the dataset set up by the user** | | + | ^SUBSCRIPTION_XML |XML describing details of a subscription on the dataset set up by the user | |
Line 143: | Line 114: | ||
==== File ==== | ==== File ==== | ||
- | ^DS_id |Dataset | + | ^U_id |**User that this file belongs to**. Part of primary key. | |
^F_name |Local path to file. The full path is given by " | ^F_name |Local path to file. The full path is given by " | ||
^F_timestamp |Timestamp of last change | | ^F_timestamp |Timestamp of last change | | ||
Line 151: | Line 122: | ||
This table is used to display recent changes to the data provider. It will not contain a complete inventory of files in the repository. This table will be purged (rows with old timestamps removed) periodically. | This table is used to display recent changes to the data provider. It will not contain a complete inventory of files in the repository. This table will be purged (rows with old timestamps removed) periodically. | ||
- | |||
- | |||
- | |||
- | |||
Line 161: | Line 128: | ||
This paragraph defines a set of subroutine/ | This paragraph defines a set of subroutine/ | ||
- | The functions are defined as methods in a **Userbase** class. Inside a Userbase object, there may be a current user and a current dataset. The current user **may or may not** own the current dataset. There may also be a current file that will belong to the current dataset. | + | The functions are defined as methods in a **Userbase** class. Inside a Userbase object, there may be a current user and a current dataset. The current user may or may not own the current dataset. There may also be a current file that will belong to the current dataset. |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
Line 186: | Line 144: | ||
^Method ^Purpose ^Parameters ^ | ^Method ^Purpose ^Parameters ^ | ||
|user_find |Search for an existing user in the database and make him/her the current user. |IN: User E-mail address, application id (A_id). | | |user_find |Search for an existing user in the database and make him/her the current user. |IN: User E-mail address, application id (A_id). | | ||
- | |user_create |Create a new user and make it the current user. |IN: User E-mail address, application id (A_id). | | + | |user_lfind |Search for an existing user in the database and make him/her the current user. |IN: User login name, application id (A_id). | |
- | |user_set | + | |user_create |Create a new user and make it the current user. |IN: User E-mail address, application id (A_id). Initially, the value of the mandatory U_loginname field will be set to the E-mail address, but this can be changed using the user_set method. | |
- | |user_get |Get user properties for the current user. |IN: Property name (one of ' | + | |user_put |
+ | |user_get |Get user properties for the current user. |IN: Property name (one of ' | ||
|user_first |Make the first user in the database the current user. |OUT: TRUE if found, FALSE if no users exist. | | |user_first |Make the first user in the database the current user. |OUT: TRUE if found, FALSE if no users exist. | | ||
|user_next |Make the next user in the database the current one. |OUT: TRUE if found, FALSE if already last user. | | |user_next |Make the next user in the database the current one. |OUT: TRUE if found, FALSE if already last user. | | ||
- | |**user_isync** |**Make the user corresponding to the current infoUDS-row (see below) the current user.** |**OUT: TRUE if found, FALSE on error.** | | + | |user_isync |Make the user corresponding to the current infoUDS-row (see below) the current user. |OUT: TRUE if found, FALSE on error. | |
- | |**user_dsync** |**Make the user owning the current dataset the current user.** |**OUT: TRUE if found, FALSE on error.** | | + | |user_dsync |Make the user owning the current dataset the current user. |OUT: TRUE if found, FALSE on error. | |
==== Dataset functions ==== | ==== Dataset functions ==== | ||
+ | Methods for manipulating the DataSet table. | ||
^Method ^Purpose ^Parameters ^ | ^Method ^Purpose ^Parameters ^ | ||
|dset_create |Create a new dataset and make it the current dataset. The current user will be the owner of the new dataset. |IN: Dataset name, dataset key. | | |dset_create |Create a new dataset and make it the current dataset. The current user will be the owner of the new dataset. |IN: Dataset name, dataset key. | | ||
- | |dset_find |Find a dataset in the database and make it the current dataset. | + | |dset_find |Find a dataset in the database and make it the current dataset. |IN: Application id, dataset name. OUT: true if the dataset is found, false otherwise. | |
|dset_first |Make the first dataset (owned by the current user) the current dataset |OUT: true if found, false if no such dataset exists. | | |dset_first |Make the first dataset (owned by the current user) the current dataset |OUT: true if found, false if no such dataset exists. | | ||
|dset_next |Make the next dataset (owned by the current user) the current dataset. |OUT: true if found, false if already last dataset. | | |dset_next |Make the next dataset (owned by the current user) the current dataset. |OUT: true if found, false if already last dataset. | | ||
- | |**dset_isync** |**Make the dataset corresponding to the current infoUDS-row (see below) the current dataset.** |**OUT: TRUE if found, FALSE on error.** | | + | |dset_isync |Make the dataset corresponding to the current infoUDS-row (see below) the current dataset. |OUT: TRUE if found, FALSE on error. | |
- | + | |dset_get | |
- | ==== Dataset information functions ==== | + | |dset_put |
- | **Methods for manipulating the InfoDS table. These methods will only work if the datasets have only one value for each information type. For the time being, this assumption seems justified.** | + | |
- | + | ||
- | ^Method ^Purpose ^Parameters ^ | + | |
- | |**infoDS_get** | + | |
- | |**infoDS_put** | + | |
==== Functions for manipulating the InfoUDS table==== | ==== Functions for manipulating the InfoUDS table==== | ||
- | **Uses the concept " | + | Uses the concept " |
^Method ^Purpose ^Parameters ^ | ^Method ^Purpose ^Parameters ^ | ||
- | |**infoUDS_set** |**Define the current set of rows and set the first row in as the current row.** |**IN: 1. Information type. 2. Keyword that tells how the set shall relate to the current user and/or current dataset (values: USER, DATASET, USER_AND_DATASET). | + | |infoUDS_set |Define the current set of rows and set the first row in as the current row. |IN: 1. Information type. 2. Keyword that tells how the set shall relate to the current user and/or current dataset (values: USER, DATASET, USER_AND_DATASET). |
- | |**infoUDS_get** |**Get information from the current row in the current set.** |**OUT: Value of I_content field (single entity or XML).** | | + | |infoUDS_get |Get information from the current row in the current set. |OUT: Value of I_content field (single entity or XML). | |
- | |**infoUDS_put** |**Replace the content field in the current row.** |**IN: Value of I_content field (single entity or XML).** | | + | |infoUDS_put |Replace the content field in the current row. |IN: Value of I_content field (single entity or XML). | |
- | |**infoUDS_next** |**Define the next row in the set as the current row.** |**OUT: TRUE on success, FALSE if no more rows in the set.** | | + | |infoUDS_next |Define the next row in the set as the current row. |OUT: TRUE on success, FALSE if no more rows in the set. | |
- | |**infoUDS_new** |**Create a new row in the set and define it as the current row. The row will belong to the user and/or dataset that defines the set. If the set is only defined by user, the current dataset will be used to connect the row to a dataset. Similarly, if the set is only defined by dataset, the current user will be used. NOTE: The new row will be set up as the last row in the current set. Used inside a loop with infoUDS_next, | + | |infoUDS_new |Create a new row in the set and define it as the current row. The row will belong to the user and/or dataset that defines the set. If the set is only defined by user, the current dataset will be used to connect the row to a dataset. Similarly, if the set is only defined by dataset, the current user will be used. NOTE: The new row will be set up as the last row in the current set. Used inside a loop with infoUDS_next, |
- | |**infoUDS_delete** |**Delete the current row.** |**OUT: TRUE or FALSE indicating success or error.** | | + | |infoUDS_delete |Delete the current row. |OUT: TRUE or FALSE indicating success or error. | |
==== File functions ==== | ==== File functions ==== | ||
^Method ^Purpose ^Parameters ^ | ^Method ^Purpose ^Parameters ^ | ||
- | |file_find |Search for an existing file (owned by the curent | + | |file_find |Search for an existing file (**owned by the curent |
- | |file_create |Create a new file (for the current | + | |file_create |Create a new file (**for the current |
- | |file_set | + | |file_put |
|file_get |Get file properties for the current file. |IN: Property name (one of F_name', | |file_get |Get file properties for the current file. |IN: Property name (one of F_name', | ||
- | |file_first |Make the first file (in the current | + | |file_first |Make the first file (**owned by the current |
|file_next |Make the next file in the database the current one. |OUT: true if found, false if already last file. | | |file_next |Make the next file in the database the current one. |OUT: true if found, false if already last file. | | ||
+ | |**file_delete** |**Delete the current file entry from the database.** |**OUT: true if the entry was deleted, false on error.** | | ||
==== Example usecase ==== | ==== Example usecase ==== | ||
- | **A dataset (D) has recently been updated, and a check is needed to see if this must be followed up by sending the dataset to external users as a consequence of subscriptions set up on the dataset:** | + | A dataset (D) has recently been updated, and a check is needed to see if this must be followed up by sending the dataset to external users as a consequence of subscriptions set up on the dataset: |
< | < |