Download RETE-DB - Manual
Transcript
2012-02-20 RETE-DB - Manual version 2 c Copyright 2008-2012 Andreas Warnke ([email protected]) Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section D entitled ”GNU Free Documentation License”. 2 3 RETE-DB - Manual RETE-DB is a multi-user web database, providing high performance, data security and system scalability. Target This program is suitable for • Address databases Define the fields you need; e.g. Name, Address, Phone number, Bank Account and limit the access rights: e.g. restrict the read access to Bank Account • Todo lists Define a Title and a Description field and a choice-list of responsible persons. • Bug management Define a choice-list for Status and Priority (e.g. open, in progress, closed and high, medium, low), an file-upload field to attach photos or videos, and restrict the write access for e.g. the Priority field • Any other list which may contain texts, numbers, dates, choice-options or even files and to which you can limit read or write access on fields or records. Features RETE-DB is a web-based database frontend, which allows to enter, search and modify records. • Custom database structure: The administrator defines the database layout via the web frontend. • Groups: Access rights are defined on groups; a group concept simplifies the administration. • Security: For every record and for every field, access rights can be defined separately. • Performance: As tests have shown (see chapter 3.8), this program is amazingly fast - even when working with hundred thousands of records. • Scalability: Multiple distributed RETE-DB instances can run in parallel on the same database. 4 • History: Every change of data is logged; even changes in the RETE-DB administration. • Export: Search results can easily be exported to spreadsheet applications. • Import: New records can be created and existing records can be updated with data of spreadsheet applications. Limits • RETE-DB is a project management tool. It is not a tool for individual issue handling as for example help-desk systems. Therefore no access rights for individual users exist, only a group concept is supported. License of RETE-DB: GPL RETE-DB 1.2, Copyright (C) 2004-2012 Andreas Warnke RETE-DB comes with ABSOLUTELY NO WARRANTY; for details see appendix C. This is free software, and you are welcome to redistribute it under certain conditions; see appendix C for details. Contents 1 User Manual 1.1 General Usage . . . . . . . . . 1.1.1 Login . . . . . . . . . . 1.1.2 Logout . . . . . . . . . 1.1.3 Change your Password 1.1.4 Menu . . . . . . . . . 1.2 Records . . . . . . . . . . . . 1.2.1 Create a Record . . . . 1.2.2 Copy a Record . . . . . 1.2.3 Record Information . . 1.2.4 Record History . . . . . 1.2.5 Modify a Record . . . . 1.3 Queries . . . . . . . . . . . . . 1.3.1 Search . . . . . . . . . 1.3.2 Bookmark a Query . . 1.3.3 Go to a Record . . . . 1.4 Export / Import . . . . . . . . 1.4.1 Export . . . . . . . . . 1.4.2 Import . . . . . . . . . 1.5 Timezones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Administration 2.1 Overview on Projects and Fields 2.1.1 Create a Project . . . . . 2.1.2 Delete a Project . . . . . 2.1.3 List all Fields of a Project 2.1.4 Create a Field . . . . . . 2.1.5 Delete a Field . . . . . . 2.1.6 Create a Keyword Field . 2.1.7 Define Keywords . . . . . 2.1.8 Delete a Keyword . . . . 2.1.9 Check Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 10 10 12 12 14 15 15 17 17 19 20 21 21 23 23 24 24 26 30 . . . . . . . . . . 31 32 33 35 35 36 41 41 43 44 46 6 CONTENTS 2.2 2.3 2.4 Access Rights . . . . . . . . . . 2.2.1 Overview . . . . . . . . . 2.2.2 Check Group Definitions 2.2.3 Check Accounts . . . . . 2.2.4 Check Group Members . Manage Users and Groups . . . . 2.3.1 Create a Group . . . . . 2.3.2 Delete or Modify a Group 2.3.3 Create a User Account . 2.3.4 Delete a User Account . 2.3.5 Check User Accounts . . 2.3.6 Define Groups of a User . 2.3.7 Check Groups of a User . Checklist . . . . . . . . . . . . . 2.4.1 Define a new Project . . 2.4.2 Check a new Project . . 3 Maintenance 3.1 Back-Ups . . . . . . . . . . . 3.2 Resume Operation . . . . . . . 3.3 Avoid Intrusion . . . . . . . . 3.4 Detect Intrusion . . . . . . . . 3.5 Unlock the Database . . . . . 3.6 Detect Viruses . . . . . . . . . 3.7 Observe Server Load . . . . . . 3.8 System Performance . . . . . . 3.8.1 Performance tuning . . 3.8.2 Distribute the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . and RETE-DB 4 Installation 4.1 Overview . . . . . . . . . . . . . . 4.2 Download RETE-DB . . . . . . . 4.3 Unzip the Archive . . . . . . . . . r 4.4 Prepare the MySQL Database . 4.5 Update the web.xml File . . . . . 4.6 Install RETE-DB . . . . . . . . . . 4.7 Install Required Java Packages . . 4.8 Setup email notification (optional) 4.9 Restart the Servlet Engine . . . . . 4.10 Check, if RETE-DB is running . . 4.11 Troubleshooting . . . . . . . . . . A Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 48 49 50 51 52 52 56 57 58 58 59 60 61 61 61 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 64 64 64 65 65 65 65 65 66 66 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 70 71 71 72 73 75 75 75 76 76 77 79 CONTENTS 7 B Colors B.1 Text Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.2 Ground Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 81 81 C The GNU General Public License 83 D GNU Free Documentation License 91 E Design E.1 Packages (static view) . . . . . . . . E.2 Packages (dynamic view) . . . . . . E.3 Perfornamce, Scalability and Security E.4 Database Design . . . . . . . . . . . E.4.1 Data Tables . . . . . . . . . E.4.2 History Tables . . . . . . . . E.4.3 Text Tables . . . . . . . . . E.4.4 Transactions . . . . . . . . . E.5 Design of Request URLs . . . . . . . E.5.1 find Parameter . . . . . . . . E.6 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 100 100 101 102 102 103 104 104 106 106 106 8 CONTENTS Chapter 1 User Manual This section describes the basic functionality of RETE-DB (record entry, modification and record queries) as well as some more sophisticated features like data export, data import or bookmarks on search queries. 9 10 CHAPTER 1. USER MANUAL 1.1 1.1.1 General Usage Login Enter the address of the RETE-DB server to a browser (E.g. Firefox, Internet r r Explorer , Safari , ...) Enter your domain (if any), login and password. Submit your login data. Note: • To use the RETE-DB system, you need to enable the ”Cookies” checkbox in the preferences of your browser. Otherwise you will be asked for your password on every second page. 1.1. GENERAL USAGE 11 All projects to which you have access are listed on this page. If you login the first time, you are asked to change your password. (see 1.1.3) Otherwise, if this is not your first login, please check the date and time of your last login. In case this information is wrong, it might be that someone else has used your account. 12 CHAPTER 1. USER MANUAL 1.1.2 Logout Please log out when you are finished. Every page provides a link in the top right corner. 1.1.3 Change your Password Every page provides a link to change the password and timezone. Note: • Some users might have fix passwords. In this case, the link is greyed out. Information on your account is displayed here: name, email address and telephone number. 1.1. GENERAL USAGE 13 You are requested to enter your current password and to enter your new password twice. You may update your timezone here. (see 1.5) Submit your new password and/or timezone. A Good Password • is at least 7 characters long • is a combination of different character types, such as capitals A-Z, lower-case characters a-z, digits 0-9 and other symbols $, %, !, ?, ... • is not a word (in any language) • is not related to the user (like the number plate of the user’s car) • is not written on a piece of paper as reminder (where other people can see it) • is known to exactly one person (meaning you and only you) A common way to find such a password is to think on a sentence that you can remember easily (e.g. ”My pink T-shirts don’t fit to my blue jeans.”) and take the first characters of each word (resulting in ”MpT-sd’tf2mbj”). 14 1.1.4 CHAPTER 1. USER MANUAL Menu The top lines of all pages look similar: The second line shows all projects to which you have access. This allows to switch between the different projects. 1.2. RECORDS 1.2 1.2.1 15 Records Create a Record Select the project. Choose [new record] to get a form for creating a new record. Note: • This option is greyed out if you do not have permission to create a new record in the current project. Fill in the requested data. Note: • If you want to limit the access to this record, remove the marks from the ’all’ group as well as from the groups which shall not have access. • Date format is ’YYYY-MM-DD’ • Time Format is ’YYYY-MM-DD hh:mm:ss’ If you want to, you can add a short explanation for your changes in the Explain field. Then click on one of the [create record] buttons. 16 CHAPTER 1. USER MANUAL After updating the record, the results are displayed. On top of the history list, a new entry is displayed which shows your modifications. 1.2. RECORDS 1.2.2 17 Copy a Record To the right, there is a [copy] link which simplifies creating several records with similar content. Note: • There is no [copy] link if you have no create record permissions. • The history is not copied. • If there are files or passwords stored in the original record, these are not copied. Afterwards, click on the [create record] button to permanently store the new record. 1.2.3 Record Information If you are not sure what to enter into a field or what meaning a multiple-choice item has, submit your changes and then click on the ’info’ link. 18 CHAPTER 1. USER MANUAL This adds description texts on green background. You may change data on this ’info’ page Or switch back to normal mode by clicking on the record id. 1.2. RECORDS 1.2.4 19 Record History Each record has a history on the bottom of its page which lists all changes. The dark grey lines shows by whom and when a modification has been done; The most recent changes are sorted to the top of the list; The first column shows what has been changed; The second column shows the new value that has been set; The third column shows the old value before the modification. 20 CHAPTER 1. USER MANUAL 1.2.5 Modify a Record You can modify any record to which you have write access. Simply change the data in the displayed fields. Note: • Fields that you cannot modify are marked by ’(ro)’ which means read only. • Some other users do not have read access to the fields marked with ’(rr)’ which means read restricted. Write a short explanation why you change the data Submit your changes. 1.3. QUERIES 1.3 Queries 1.3.1 Search Click on the [list] link to get to the search form. Here you can enter search criteria for records and order the results. Submit your query. 21 22 CHAPTER 1. USER MANUAL Note that there might be multiple result pages. In this case, you have to click on the different page links to see the results. The total number of records to which you have access and which match your query is displayed on the right. Click on the record ids to see the detailed record data. Note: • You can enter multiple conditions for your query: RETE-DB allows to define several conditions on several fields simultaneously. • Multiple criteria for one field are logically connected by an OR, criteria for different fields are logically connected by a lower priority AND. • Some field types allow to invert the search: After searching on a field, a checkbox with the label ”not” appears and can be selected. 1.3. QUERIES 1.3.2 Bookmark a Query You can store the current query in your Bookmark or Favorite List. 1.3.3 Go to a Record Enter the record id in the middle of the third line and press [show]. 23 24 CHAPTER 1. USER MANUAL 1.4 1.4.1 Export / Import Export Select a project Search for all records which you want to export; the total number of records is displayed on the right then. The export file will contain all records that match to your current search. (Supposed there are 348 records that match your search criteria but there are only 50 displayed in your browser, all 348 records will be exported nonetheless.) On the bottom of each [list] page, some export links are shown. The format of the export is either csv (comma separated values) or XML. There are slight variations between the csv file formats of different spreadsheet applications. Therefore, there are several csv formats provided. Try these links to determine which format is the best for your purposes. 1.4. EXPORT / IMPORT Click on an export link and save the file to disk. 25 26 CHAPTER 1. USER MANUAL 1.4.2 Import If you want to import data from a spread sheed application, the first row must list the field names of the RETE-DB project. Save the file in CSV (Comma Separated Values) format. The encoding shall be set to UTF-8, Latin-1 or Unicode (UCS-2); the cell separator can be either semicolon, colon or tab; the quoting symbol should be a double-quote. When saving the file in CSV format, some formatting information will be lost. 1.4. EXPORT / IMPORT 27 In RETE-DB, select the project to which you want to import data. Go the the [import] page of the project to which you want to import data. Note: • Since updating existing records may change the complete project by one single action, you need special permissions to this. Choose the CSV file which to import. ’Encoding’: Select the character encoding in which the application stored the csv file. If you are ot sure, select Latin-1. This fits in many cases. ’Match ID Column’: Choose ’(none, all records are new)’, if all imported records are new. If you want to update existing records, choose the field name by which the imported records shall be matched to the existing RETE-DB records. Upload the file in ’Test Only’ mode first. 28 CHAPTER 1. USER MANUAL Check the results of the upload. Are there red-colored items? If everything is ok, choose the file again Remove the ’Test Only’ option. Upload the import file a second time. 1.4. EXPORT / IMPORT 29 Uploading a file might take some minutes. The reason for this is partly the huge number of history entries that need to be created and partly the way how RETE-DB ensures that your import does not block the RETE-DB system for other users. Check also the second error report because the first error report checked the file structure only, not the access rights. Look out for red-colored items. 30 CHAPTER 1. USER MANUAL 1.5 Timezones All time values and history dates are stored in universal time (UTC=Universal time coordinated). UTC is the time on longitude 0 degree. Since longitude 0 is defined at London’s suburb Greenwich, UTC is also called Greenwich mean time (GMT). For easier handling of UTC times, these times are converted from and to local time when entering and displaying these time values. This feature only works if every user sets the timezone correctly: This can be done via the [change password] link in the top line of each page (see 1.1.3). A list of cities and their timezones is displayed there. Choose the appropriate timezone and click on the [change] button. Note: • The RETE-DB system does not switch automatically between summer (daylight savings) and winter (standard) time. If you are living in a region where summer and winter time are not identical, you need to switch your timezone twice each year. Chapter 2 Administration This chapter describes how to create projects and how to manage accounts. 31 32 2.1 CHAPTER 2. ADMINISTRATION Overview on Projects and Fields <projects> define the tables, <fields> define the columns of each table, <keywords> define the options of drop-down (’KEYW’) and multiple-choice (’MULT’) typed ’fields’. 2.1. OVERVIEW ON PROJECTS AND FIELDS 2.1.1 33 Create a Project To create a new project, go to project [<projects>], page [new record]. Take into account that every project causes some administration efforts. In some cases it is simpler to extend an existing, similar project than to create a new one. Enter the requested information. • Label: Give your new project a name. This can be modified later. • WriteDB: This is an Url that is needed to access a database. The user and password should be encoded in this DB Url. An example URL looks like: jdbc:mysql://127.0.0.1:3306/rete db data?user=RETEDB&password=aaaabbCd&characterEncoding=utf8 • ReadDBs: See WriteDB above. Multiple DB Urls are separated by a whitespace character. • TablePrefix: This is a database-internal identifier that cannot be modified after creation. Choose a name that is similar to the Label. (Please choose only lowercase letters a-z , underscore or digits 0-9; the first character must be a letter.) Note: This identifier needs to be unique among all projects in the RETE-DB system. 34 CHAPTER 2. ADMINISTRATION • ArchiveFolder: This is a path to a folder in the filesystem where RETE-DB stores all uploaded files. Note: 1) RETE-DB needs read and write access to this folder. 2) This path must be accessible from all RETE-DB instances if RETE-DB is distributed to different servers. There are some less important fields that you may want to fill in: • Order: Allows to position this project within the list of all projects. Increase the number to shift this project right, decrease the number to shift it left. • Description: Provide a short description for this project. This is visible to all users. • Default Order Field ID: Choose the field by which the search results shall be ordered if a user has not provided a search order. • Default Order Direction: Choose the direction (ascending or descending) if a user has not provided a search order. Press the [create record] button. The <projects> record is created, the database structure is modified. Also the two default <fields> ’Id’ and ’Access’, the <groups> ’admin’ and ’all’ and some <members> records are created. 2.1. OVERVIEW ON PROJECTS AND FIELDS 2.1.2 35 Delete a Project A project cannot be deleted from the database, but you can revoke all access rights. See chapter 2.2 how to hide a project. 2.1.3 List all Fields of a Project Go to project [<fields>], page [list]. To check, which ’fields’ are already defined, [search] for all fields of the project. Up to 318 fields per project may be defined. 36 CHAPTER 2. ADMINISTRATION 2.1.4 Create a Field To create a new ’field’, go to project [<fields>], page [new record]. Enter the requested information. Note: • ’Project’, ’Type’ and ’Field’ are fix and cannot be changed later. • Field: The field name needs to be unique within this project. This is just a database-internal identifier and has no effect on anything the user can see. • Field: Choose only letters A-Z, a-z, underscore must be a letter. Type You can choose the following types for your fields: • INT Integer number • REAL Real number • DATE Date (without time) or digits 0-9; the first character 2.1. OVERVIEW ON PROJECTS AND FIELDS 37 • TIME Date and time (with automatic conversion between timezones) • TX16 Varchar 16: String of up to 16 characters • TX32 Varchar 32: String of up to 32 characters • TX80 Varchar 80: String of up to 80 characters • TXCC Varchar 200: String of up to 200 characters • TEXT MediumText: String of arbitrary length. Note on performance: Do not use this type if a TXCC is sufficient. • KEYW Dropdown-box which references a single keyword. How to create the list of keywords is explained in 2.1.7. • MULT Multiple-choice is a selection of multiple keywords. How to create the list of keywords is explained in 2.1.7. • FILE One file. Use a zip archive if you want to upload several files to a FILE field. • ID RETE-DB internal type for the Id field. Do not use this type for other fields. • ACL RETE-DB internal type for the Access field. Do not use this type for other fields. • PASS Password field • PROJ Project list • GR P Group list. This list only makes sense in combination with one PROJ field; otherwise the list will be empty. (This type should not be used except in the administration projects.) • Nto1 Reference to one record of another project. (This type requires that the ’Foreign Project’ field is filled in.) Options Check the ’index’ box if you want to speed up searches on this field. Only check this option if this field is often searched because indices slow down other functions and occupy memory. There is no need to define an index on the ’ID’ field because this field has already an database-internal index. 38 CHAPTER 2. ADMINISTRATION Note: • Indices on TEXT-typed fields cannot be created if the character encoding of the database table is ucs2 or if MySQL is older than version 3.23.23 or if the table-type is not MyISAM. • Indices on TEXT fields cannot be removed. • MySQL does not allow to define more than 16 indices per table. 2 are already used by RETE-DB internally, 14 are remaining for your purposes. Foreign Project If the field type is Nto1, the Foreign Project states the number of the project which shall be referenced by the Nto1 field. Finally, press the [create record] button. The <fields> record is created, the database structure is modified. Update the fields ’Write Access’ and ’Read Access’ for the new ’field’ now. Press the [update] button again. 2.1. OVERVIEW ON PROJECTS AND FIELDS 39 A new ’field’ is created. If the field is of type ’KEYW’ (dropdown box) or ’MULT’ (multiple choice), you need to define the <keywords> (see 2.1.7). Display Options for Fields There are some options that affect the color and layout of the fields: • Form Order: This is a number that controls the position of the field in the form layout: The lower the number, the higher the line where the field is displayed. If fields have identical or consecutive numbers, RETE-DB tries to display these fields in the same line. • List Order: This is a number that controls the position (column) of the field in the list layout. (For Nto1 fields, this number also influences which field shall be displayed in other projects when referencing this project. The TX32, TX80 or TXCC field with the lowest list order will be shown.) • Text Color: Here, you can enter a color for the field name in the format #rrggbb where r,g and b are numbers from 0,1,2,...,9,a,b,c,d,e,f. Every color is mixed from a red (rr), a green (gg) and a blue (bb) component. #000000 is black, #ffffff is white, #00ff00 is green, #ff0000 is red, #ffff00 is a mix of green and red which results in yellow. See chapter B for more examples. 40 CHAPTER 2. ADMINISTRATION • Ground Color: Background color of the field name. See chapter B for examples. Leave this field empty for a white background. • Form Layout: You can influence the layout of some field types by setting this option. The width of the input fields can be changed by ’ACL Wide Input’, ’Nto1 Wide Input’, ’TX80 Narrow Input’, ’TXCC Narrow Input’, ’MULT Narrow Input’; links can be highlighted by ’TEXT HTTP-Link’. • List Layout: Set this option to ’**** Hidden’ if you want to hide a field (column) in the list view. Note: The field is not completely invisible: Every user who has read access still can make this field visible in the list page by selecting the ’list all columns’ option. The other options influence text style and colors: ’**** Black on Light Color’, ’**** Bold Black on Light Color’, ’**** Black on White’, ’**** Bold Black on White’, ’**** Original Colors’, ’**** Bold/Original Colors’. Consistency Options for Fields RETE-DB allows to define rules that reject changes of records and rules that do automatic changes after a user modified a record. Some of these rules are already built into RETE-DB - but it is also possible to define your own rules by writing some lines of java code. • Consistency Type: Activates consistency rules for this field. E.g. the rule that logs the last modification date is activated by the ’TIME LastMod’ marker. Note: • Automatic changes to records are only possible if the admin group (Group Mask 0) has write access to this field. E.g. the ’TIME LastMod’ rule does not work on fields without write access for the admin group. Consistency Types The following types are predefined in RETE-DB 1.2: • TIME Created The time of the record creation is logged in this field. This only works if all groups that have record creation rights also have read access to this TIME field. • TIME LastMod The time of the last modification is logged in this field. This only works if all groups that have any write access also have read access to this TIME field. 2.1. OVERVIEW ON PROJECTS AND FIELDS 41 • ACL Admin Access Ensures that the administration group (0) always has access. Apply this consistency type to the Access field of the relevant project. • TX** Mandatory Ensures that this field is never empty. This type can be applied to TX16, TX32, TX80 and TXCC field types. This only works if all groups that have record creation rights also have write access to this field. 2.1.5 Delete a Field Fields cannot be deleted. Also, the type cannot be changed. But you can remove all access rights to hide a field (see 2.2). 2.1.6 Create a Drop-Down or Multiple Choice (Keyword) Field A keyword is a selectable option in a drop-down box or multiple-choice field. To define a keyword, create a field as shown in chapter 2.1.4. Set the Type to ’KEYW’ for a drop-down box or to ’MULT’ for a multiple-choice field. 42 CHAPTER 2. ADMINISTRATION Update Read Access and Write Access fields. An Id is assigned to the new keyword field: 1067. 2.1. OVERVIEW ON PROJECTS AND FIELDS 2.1.7 43 Define Keywords To create a new ’keyword’, go to project [<keywords>], page [new record]. Enter the ’Project’, the ’Field Id’ (1067 in example of chapter 2.1.6) and a ’Label’. If this ’keyword’ is used in a ’field’ of type ’MULT’, check one of the ’Bit Mask’ flags. Do not change this flag later. Every keyword has an order field which defines the position of the keyword within a dropdown box. The lower the number, the higher the keyword appears within the list. 44 CHAPTER 2. ADMINISTRATION Note: • The order field does not define the order of search results when sorting results by this keyword. Search results are always sorted by the keyword ID (in case of single-select keywords) or by the Bit Mask (in case of multi-select keywords), never by the order field of the keywords. • The field ’Notification Email’ defines, to which distribution list an email shall be sent when the keyword gets selected. This field is intended to contain the email address of one distribution list. It is possible to add multiple email addresses here, separated by whitespace. Email are only sent if this feature is activated; see 4.8 To create several ’keywords’ for the same ’field’, click on the [copy #4116] link. 2.1.8 Delete a Keyword There may be several phases when deleting a keyword. • The first most likely is disabling the keyword entry: By selecting the Entry disabled flag, nobody can enter this keyword anymore. • The second phase is disabling the search for the keyword: By selecting the Search disabled flag, it is not possible anymore to search for this keyword. 2.1. OVERVIEW ON PROJECTS AND FIELDS 45 • The third step is to update all records where this specific keyword is still set: This must be done manually for every single record. 46 2.1.9 CHAPTER 2. ADMINISTRATION Check Results To see how the project looks like, go to the new project [Feature List XZ2], page [list]. Then, go to page [new record]. 2.1. OVERVIEW ON PROJECTS AND FIELDS At last, check the page [info]. 47 48 2.2 2.2.1 CHAPTER 2. ADMINISTRATION Access Rights Overview All access rights are defined on ’groups’. A ’group’ has read access to data if ’Access’ to the record and ’Read Access’ to the ’field’ is granted. A ’group’ has write access if ’Access’ to the record and ’Write Access’ to the ’field’ is granted. Notes on ID and Access Fields: Write access on the ID field is the record creation right. Write access on the Access field is also record deletion right since removing all access rights is equal to deleting a record. 2.2. ACCESS RIGHTS 49 If a user creates a record who has no write access to the Access field, this new record is visible to all groups that are listed in the Default Access field of the user’s groups. 2.2.2 Check Group Definitions Go to the project [<groups>], page [list]; search for the ’Project’ you are interested in. Here you see all groups that are defined for this ’project’. 50 2.2.3 CHAPTER 2. ADMINISTRATION Check Accounts Go to the project [<users>], page [list]. This page lists all user accounts. Note that this page does not show, which user belongs to which group. [<members>] project lists this relation (see 2.2.4). The 2.2. ACCESS RIGHTS 2.2.4 51 Check Group Members Go to the project [<members>], page [list]; search for the ’Project’ you are interested in. This page lists, which user is in which group. Note that all group definitions are project-specific: If a user is in group ’admin’ in project ’Address’ for example; this does not mean that this user has any rights in any other project. 52 2.3 2.3.1 CHAPTER 2. ADMINISTRATION Manage Users and Groups Create a Group Go to the project [<groups>], page [list]. Search for the ’Project’ you are interested in. As you see, all groups are specific to one project; there are no system-wide groups. Check, which group masks are already in use (0 and 1 in this case, ignore the ’all’ group). 2.3. MANAGE USERS AND GROUPS 53 Go to the project [<groups>], page [new record]. Check one of the ’Bit Mask’ flags which are still unused. Do not change this flag later. Enter all data and press [create record]. 54 CHAPTER 2. ADMINISTRATION Update the ’Default Access’. This field defines who has access to a record created by this group. Then press [update #1000]. Note: • Which user is in this group will be defined by <members> records. • The option ”Include LDAP members” allows to add all LDAP users to this group without defining records int the <members> project. 2.3. MANAGE USERS AND GROUPS A new ’group’ exists now. 55 56 CHAPTER 2. ADMINISTRATION Create all groups you need and check the result on the [<groups>]/[list] page. 2.3.2 Delete or Modify a Group Never change the label or group mask of a group (except spelling errors or in new, empty projects) since you would change only the label of a group; all existing definitions of access rights would change their intension. You cannot delete a group. 2.3. MANAGE USERS AND GROUPS 2.3.3 57 Create a User Account Go to the project [<users>], page [new record]. Enter all data (including an initial password) and press [create record]. Note: • The fields ’Last IP’, ’Failed Trials’, ’Last Login’, ’Last Logout’ and ’Password Change’ need not be filled in. These fields are updated by RETE-DB automatically. • The fields ’Options’ and ’Admin Options’ allow to control - if the user may login (see 2.3.4), - if changing the password or timezone for this user is allowed, - if the user can only login via a valid LDAP account and password, - if the user gets informed on his/her last login date, - if the user can see the log files, - if the user knows about the import problems (see E.4.4) and therefore is allowed to overwrite fields by an import - or do other administration tasks. 58 2.3.4 CHAPTER 2. ADMINISTRATION Delete a User Account A user account is deleted by setting the ”Login disabled” flag in the options field of the user. Note: If the user is logged in at that time, this user is thrown out of the system immediately. 2.3.5 Check User Accounts Go to the project [<users>], page [link]. 2.3. MANAGE USERS AND GROUPS 2.3.6 59 Define Groups of a User A Member record defines, to which groups a user belongs. For every user and every project, there should be zero or one record in the <members> project: if there is no record for a user/project pair, the user has no access to the project at all; if there is one record for a user/project pair, the ”Groups” field defines to which groups the user belongs. Go to the project [<members>], page [new record]. Enter ’User ID’ and ’Project’ and press [create record]. Enter all ’Groups’ to which the user belongs and press [update #1000]. 60 2.3.7 CHAPTER 2. ADMINISTRATION Check Groups of a User Go to the project [<members>], page [list]; search for the ’User ID’ you are interested in. 2.4. CHECKLIST 2.4 61 Checklist This chapter provides two checklists to ensure that a new project is created successfully. 2.4.1 Define a new Project Major tasks that need to be done when creating a new project are listed here. • Create one <projects> record. • Create several <fields> records. • For all KEYW and MULT fields, create the appropriate <keywords> records. • Define all <groups> for this project. • Define, which user is in which group, by adding one <members> record for each user who shall have access. 2.4.2 Check a new Project Some issues are stated here that are easily forgotten when creating a new project. • Check, if the default access rights of the new <groups> are set. • Check the read and write permissions on the new <fields> records. • Check the <members> records, if all users are in the right groups. 62 CHAPTER 2. ADMINISTRATION Chapter 3 Maintenance Read this chapter to get an overview on the following tasks: • Back-ups + Resuming Operation • Avoiding Intrusion + Intrusion Detection • Virus detection • Observing server load + Performance Tuning 63 64 CHAPTER 3. MAINTENANCE 3.1 Back-Ups Back-ups must be done from the database contents and from the file-archive directories. r As described in the MySQL documentation, back-ups of the database can be invoked by one of the four commands mysqldump, mysqlhotcopy, cp or scp. Remember r to lock and flush the tables when using the cp or scp commands (via the MySQL commands LOCK TABLES, FLUSH TABLES and UNLOCK TABLES) before copying the database files. To keep the reference integrity of the data, it is strongly recommended to do the backups in the following order: • First back-up all user projects (this is the rete db data database), • then back-up all administration projects (this is the rete db meta database) and • at last copy the file archive folders to your back-up media. 3.2 Resume Operation To copy your data from one system to another or to recover from a backup, install the RETE-DB system as explained in chapter 4. Before starting RETE-DB, copy the databases to your new system as well as the file archive folders. Check the parameters in the WEB-INF/web.xml file and check the following fields in the database: • rete db meta.accs projects data.Read DBs • rete db meta.accs projects data.Write DB • rete db meta.accs projects data.ArchiveFolder Then start RETE-DB and check the system. 3.3 Avoid Intrusion One vulnerable point of a world-wide accessible multi-user system is that some users ignore security issues. It therefore is the administrator’s task to regularly remind all users on the security problems stated on the change-password page (see chapter 1.1.3). Another problem is, that access right are not revoked automatically when a user leaves a project. The administrator should take care of keeping the list of valid user accounts up-to-date. 3.4. DETECT INTRUSION 3.4 65 Detect Intrusion After every login, each user should check the date of the last login. If this date is not correct, it is likely that someone else used this users account in the meantime. If this happens, this user should change the password immediately and inform the administator as soon as possible. The administrator then should check the log files to find out what happended. 3.5 Unlock the Database To unlock the database after a brute force attack, login directly to your MySQL database and set the accs users data.Options fields to 0. 3.6 r Detect Viruses RETE-DB is completely ignorant to any code that is uploaded to the server. A virus is stored in the database and sent to the clients as any other data. It is not executed on the RETE-DB server. This seems to be a consequent and robust handling, but please note: This makes RETE-DB a perfect virus storage. Therefore it is strongly recommended to install a virus scanner on the RETE-DB server that regularly scans the file-archive directories. 3.7 Observe Server Load As a system administrator, it is your task to monitor the system load and check if there is enough performance available. Good tools, which you may consider to install, are webalizer and sar: they analyze http requests and server load. 3.8 System Performance RETE-DB is an amazingly fast database. On fast computers with only few data anyway but even on slow computers with hundred-thousands of records, working with RETE-DB is fun: My iBook G3 needs only 20 seconds to search through 200.000 records (5-58 sec). 10.000 existing user accounts have no effect on the efficiency of a single request. Even my 10 years old 120 MHz PPC604 Processor without Java Just-In-Time Compiler needs only 20 seconds to search through 200.000 records (6-50 sec). On both tested systems, the hard-disk speed was the limiting factor. This chapter describes, how you can further improve response times. 66 CHAPTER 3. MAINTENANCE 3.8.1 Performance tuning Creating indices on fields that are often searched is the most common way to enhance performance. This can easily be done by checking the index option of the <fields> records as shown in chapter 2.1.4. Other options are: • If there are a lot of TEXT fields defined in a project, modify the constant net.rete db.RETE DB.security.RowSelector.MAX TEXT JOINS between 3 and 30 and recompile RETE-DB. Set this value to a higher value if your database runs r on a remote machine or if your MySQL database has a lot of memory; set it to lower values if memory is limited. • Use a faster computer with more memory. 3.8.2 Distribute the Database and RETE-DB If the performance is still not sufficient, you have the following options: • Distribute the RETE-DB servlet to multiple computers and let multiple instances run in parallel. • Use a load balancer to dispatch the http requests to these RETE-DB instances. 3.8. SYSTEM PERFORMANCE 67 r • Replicate the MySQL databases: RETE-DB will send all UPDATE and INSERT requests to the master server and RETE-DB will send the SELECT statements to the local, replicated database. r • Partition the MySQL database and distribute the different RETE-DB projects to different servers. You can do this also with the uploaded files if necessary. 68 CHAPTER 3. MAINTENANCE Chapter 4 Installation This chapter explains how to install RETE-DB. 69 70 CHAPTER 4. INSTALLATION 4.1 Overview The following environment is required: • MySQL • Java TM r database Runtime Environment • Servlet Engine (e.g. Apache Tomcat TM ) • mysql-connector-java-5.1.18-bin.jar (see 4.7) • commons-fileupload-1.2.1.jar and commmons-io-1.4.jar (see 4.7) • ldap.jar and utilities.jar (see 4.7) Optionally, you may want to install r • phpMyAdmin or MySQL -Administrator • Apache TM HTTP Server • mod jk to connect Apache Tomcat provides load balancer functionality. TM to Apache • mod ssl to provide encrypted data transfer TM HTTP Server. mod jk also 4.2. DOWNLOAD RETE-DB 4.2 Download RETE-DB 4.3 Unzip the Archive 71 72 CHAPTER 4. INSTALLATION 4.4 Prepare the MySQL r Database Login to your database system, create two databases and a database-account with access to these. Note: • Adjust the ”@127.0.0.1” or ”@localhost” restriction if your database runs on a remote server. • utf8 allows fulltext indices even in older MySQL database versions and might therefore be more interesting than ucs2. • If your database is older than MySQL 4.1, do not specify a DEFAULT CHARACTER SET since this is not supported. 4.5. UPDATE THE WEB.XML FILE 4.5 73 Update the web.xml File Update the settings in the web.xml file: Note: In the web.xml file, the character & needs to be replaced by & . Check, that the www user has access to the File-Upload folder: There are several parameters to configure a connection to an LDAP server if you want to use external authentication: 74 CHAPTER 4. INSTALLATION • LDAP Enabled • LDAP ServerHost • LDAP ServerPort • LDAP ServerLoginDN • LDAP ServerPassword • LDAP UserLoginDN Check the comments in web.xml for a description on these parameters. A <users> record will be created automatically when an LDAP user logs in. 4.6. INSTALL RETE-DB 4.6 75 Install RETE-DB TM Copy the RETE-DB folder to your Apache Tomcat webapps folder. Rename it to for example MyReteDb. Change the owner of all files in MyReteDb to www. 4.7 Install Required Java Packages Three Java packages are required that are not part of a the standard Java Runtime Environment: A MySQL database driver (org.gjt.mm.mysql.Driver or com.mysql.jdbc.Driver; this is contained in the archive mysql-connector-java-5.1.18-bin.jar; see http://www.mysql.com) The Jakarta File Upload Classes (commons-fileupload-1.2.1.jar and commmons-io1.4.jar; see http://www.apache.org) And the OpenLDAP Classes (novell-jldap-devel-2009.10.07-1unix contains ldap.jar and utilities.jar; see http://www.openldap.org) These packages shall exist somewhere in the Java classpath. You can put these e.g. in tomcat/common/lib (for tomcat and all web-apps access) or tomcat/shared/lib (for access by all web-apps) or tomcat/webapps/MyReteDb/WEB-INF/lib (for access by RETE-DB only). 4.8 Setup email notification (optional) To enable sending email notifications, unzip rete-db notifications.jar, edit the file net/rete db/rete db/consistency/SendMailConfiguration.properties and zip the archive again. If your java runtime environment does not provide the J2EE packages, you need to install the packages activation.jar, imap.jar, mailapi.jar, pop3.jar, smtp.jar. See RETEDB 3rd party libs.zip at http://sourceforge.net/projects/accs/files/RETE-DB/RETEDB 1.1.9 dev/ 76 4.9 4.10 CHAPTER 4. INSTALLATION Restart the Servlet Engine Check, if RETE-DB is running Start a browser and enter the address of RETE-DB: The initial password is: Domain: RETE-DB Login: root Password: RETE-DB 4.11. TROUBLESHOOTING 4.11 77 Troubleshooting In case of problems, • set the DebugLevel in the web.xml file to debug (see 4.5), • enable logging in your Servlet Engine, • restart your Servlet Engine and • check the log files. This may help you in finding the problem. Note: • A ClassNotFound or NoSuchMethod exception may indicate incompatibilities to the installed libraries 78 CHAPTER 4. INSTALLATION Appendix A Trademarks • Apache dation TM and Apache Tomcat TM are trademarks of the Apache Software Foun- • Firefox is a browser name of Mozilla r • Internet Explorer is a registered trademark of the Microsoft group of companies. • Jakarta is a name of a project of the Apache Software Foundation. TM TM TM • Java , JRE and JVM are trademarks of Sun Microsystems, Inc. or its subsidiaries in the United States and other countries. r • MySQL is a registered trademark of MySQL AB in Sweden and other countries. MySQL is a trademark in the United States and other countries. r • Safari is a trademark of of Apple Inc., registered in the U.S. and other countries. • sar is the name of a program which analyzes system performance • webalizer is the name of a program which displays server statistics 79 80 APPENDIX A. TRADEMARKS Appendix B Colors This chapter shows some example colors. B.1 #000000 #333333 #000055 #003333 #003300 #442200 #550000 #440033 B.2 #ffffff #cccccc #ccccff #ccffff #ccffcc #ffffcc #ffcccc #ffccff Text Colors Black Gray Blue Blue-Green Green Brown Red Violet Ground Colors White Gray Blue Blue Green Yellow Red Violet 81 82 APPENDIX B. COLORS Appendix C The GNU General Public License Version 2, June 1991 c 1989, 1991 Free Software Foundation, Inc. Copyright 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software—to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation’s software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. 83 84 APPENDIX C. THE GNU GENERAL PUBLIC LICENSE We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author’s protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors’ reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone’s free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. Terms and Conditions For Copying, Distribution and Modification 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The “Program”, below, refers to any such program or work, and a “work based on the Program” means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term “modification”.) Each licensee is addressed as “you”. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: 85 (a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. (b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. (c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: (a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, (b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 86 APPENDIX C. THE GNU GENERAL PUBLIC LICENSE (c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients’ exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If 87 you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and “any later version”, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will 88 APPENDIX C. THE GNU GENERAL PUBLIC LICENSE be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. No Warranty 11. Because the program is licensed free of charge, there is no warranty for the program, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the program “as is” without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction. 12. In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the program as permitted above, be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if such holder or other party has been advised of the possibility of such damages. End of Terms and Conditions Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. 89 one line to give the program’s name and a brief idea of what it does. Copyright (C) yyyy name of author This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) yyyy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type ‘show w’. This is free software, and you are welcome to redistribute it under certain conditions; type ‘show c’ for details. The hypothetical commands show w and show c should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than show w and show c; they could even be mouse-clicks or menu items— whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a “copyright disclaimer” for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program ‘Gnomovision’ (which makes passes at compilers) written by James Hacker. signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. 90 APPENDIX C. THE GNU GENERAL PUBLIC LICENSE Appendix D GNU Free Documentation License Version 1.2, November 2002 c Copyright 2000,2001,2002 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The purpose of this License is to make a manual, textbook, or other functional and useful document ”free” in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of ”copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 91 92 APPENDIX D. GNU FREE DOCUMENTATION LICENSE 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The ”Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as ”you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A ”Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A ”Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The ”Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The ”Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A ”Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not ”Transparent” is called ”Opaque”. Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed 93 for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The ”Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, ”Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text. A section ”Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as ”Acknowledgements”, ”Dedications”, ”Endorsements”, or ”History”.) To ”Preserve the Title” of such a section when you modify the Document means that it remains a section ”Entitled XYZ” according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying 94 APPENDIX D. GNU FREE DOCUMENTATION LICENSE with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. 95 F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled ”History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled ”History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the ”History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled ”Acknowledgements” or ”Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled ”Endorsements”. Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled ”Endorsements” or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles. You may add a section Entitled ”Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties–for example, statements of 96 APPENDIX D. GNU FREE DOCUMENTATION LICENSE peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled ”History” in the various original documents, forming one section Entitled ”History”; likewise combine any sections Entitled ”Acknowledgements”, and any sections Entitled ”Dedications”. You must delete all sections Entitled ”Endorsements”. 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. 97 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an ”aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled ”Acknowledgements”, ”Dedications”, or ”History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/. 98 APPENDIX D. GNU FREE DOCUMENTATION LICENSE Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License ”or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: c Copyright YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no BackCover Texts. A copy of the license is included in the section entitled ”GNU Free Documentation License”. If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the ”with...Texts.” line with this: with the Invariant Sections being LIST THEIR TITLES, with the FrontCover Texts being LIST, and with the Back-Cover Texts being LIST. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. Appendix E Software Design Several aspects of the general design, speed, scaling and security issues are described here. The abstraction level of this description is focused on packages, not on classes. See the javadoc documentation for a low-level interface specification. 99 100 APPENDIX E. DESIGN E.1 Packages (static view) RETE-DB implements an MVC architecture: • model (entity classes) and security (DB access classes) • view and export • controller (event handler), import and consistency (business logic) • utils The controller package implements a Front Controller Design Pattern: All requests are passed to net.rete db.RETE DB.controller.Main which first identifies the user and then dispatches the request to the appropriate handler. RETE-DB is designed to be a lean database front-end with access control and logging functionality. Both features are implemented by the security package. Additionally, there is a mechanism designed to implement some consistency checks. This can support the workflow of your process to some degree: Modifications to records can be rejected easily or additional changes can be done in the database automatically. E.2 Packages (dynamic view) RETE-DB is an event-driven application: All actions are caused by a request to the servlet container. RETE-DB first handles the requested actions and collects the results in a result list; then it displays these results and the requested information to the user. A typical call chain is: • A user requests modifications to and information from the database, • Main (the front controller class) checks the login data, • Main delegates the modification request to the Updater class in the controller package, • the Updater asks the consistency package if the changes are allowed, • the Updater performs the modifications on the database (via the security package), • the Updater tells the consistency package to do additional changes, • the Updater returns a list of results to Main, • Main tells the view package to display the results as well as the requested information, • the view package displays the result list, E.3. PERFORNAMCE, SCALABILITY AND SECURITY 101 • the view package requests information form the database via the security package and displays the results. Access Control Boundaries There are three possible data streams: From the http request to the database, from the database to the html response, from the request directly to the response. Access is controlled at the database boundary by the security package: If the current user has no read access, data must never be loaded from the database to the RETE-DB servlet. If the user has no write access, data must never be sent to the database. Note: The consistency checks can bypass these rules if necessary by requesting a superuser account. E.3 Perfornamce, Scalability and Security High performance is achieved by the following concepts: • Database design: Some redundancy decreases the number of SQL statements and inner joins. Redundant fields are marked with the ending ’Copy’ in their database field name. • Access rights are determined by simple bit operations, no joins to group or users tables are required. • No use of tag libraries, servlet frameworks, xml transformations • Database connection pools • Object pools • Avoiding String manipulations • Avoiding Object creations • Only a few SQL statements per http-request are sent to the database - which is a great advantage if the database is located on a remote server • Only few bytes are stored in the session object. This speeds up the data transfer between servlet engines when these are distributed to different servers Scalability is possible through • The MySQL database, the RETE-DB servlet and the Apache webserver can be distributed to different computers. • only the few, serializable session data, a database connection and NFS access are required for an instance of the RETE-DB servlet to handle a request. This allows RETE-DB to run simultaneously on different servers. 102 APPENDIX E. DESIGN • The database is clustered, tables can be distributed to different databases on different computers • Only few SQL commmands are sent from the RETE-DB servlet to the database. This avoids that the network becomes the bottleneck when moving the database to a remote server. • The MySQL feature of replicating one database to different servers is supported. Security A clear and restrictive security policy which was already part of the design before the first line of code was written, guarantees the safety of the data: • Data to that the user has no read access is never loaded from the database to the RETE-DB servlet. • Data to that the user has no write access is never sent to the database. • Responsibility for these access checks is located at the security package. • The fact that neither SQL statements nor SQL connection objects must ever cross the package boundary of the security package allows the security package complete access control on the database. • If someone probes invalid passwords, this user’s account is disabled automatically. • Passwords are encrypted before they are stored in the database. E.4 Database Design For every project, a group of three tables exists in the database: A data table which contains the current values, a log table which contains the histories and a table storing long texts. There are some table groups for the administration tasks (<projects>, <fields>, <keywords>, <users>, <groups>, <members>) and there is one of these groups for each custom project that is managed by RETE-DB. Most of these table groups are independant of each other. This enables a distribution of the databases to different servers. The <projects> and the <members> tables must be located in the same database. For compatibility to future versions, it is recommended to keep all administration tables in one database. E.4.1 Data Tables Each project has a data table. Data records consist of the following information: E.4. DATABASE DESIGN 103 • ACCS Id: Id of the record. (The name of this field still reflects the former program name: Access controlled cell server). • ACCS Read: Read rights to this record. This is a bitmask; each bit sets or revokes access for one group. This field also determines the write access. There is no separate write access field for the following two reasons: It is difficult to explain separate write and read permissions to the users, and this solution would not fit to many real-world problems where write access is better controlled by the more flexible consistency checks. • ...: Any number of user-defined fields. These are appended to this table automatically when a record in the <fields> project is created. • FILE fields are also user-defined, but in contrast to the other field types, every FILE field produces three fields in the database: ACCS FilePath ..., ACCS FileSize ... and ... (where ... is the field name). E.4.2 History Tables Each project has a history table. History records consist of the following information: • Id: Id of the history entry • ReadSnapShot: Read access to the modified field at the time when the history entry was created. • DataRow: Id of the modified record • NewStart: Time when the change was made • NewEndCopy: Time when the next change to the field is made. This information is currently not used - but it is interesting if you want to implement a search or data-export on a past time. • UserId: ID of the user who did the changes. • UserNameCopy: A copy of the user’s name. This field is not updated when the name of the user is modified later. • Action: Currently there are only two types: created (1) and modified (2) • Reason: Explanation text • FieldId: Id of the field that was modified • OldValueCopy: Value before the change • NewValue: Value after the change 104 APPENDIX E. DESIGN • OldTextCopy: Only for TEXT fields: Id of the text record before the change • NewText: Only for TEXT fields: Id of the text record after the change • OldValue2Copy: Only for FILE fields: Filesize before the change • NewValue2: Only for FILE fields: Filesize after the change • OldValue3Copy: Only for FILE fields: Path to the file in the filesystem of the server • NewValue3: Only for FILE fields: Path to the file in the filesystem of the server E.4.3 Text Tables Each project has a text table. The reasons for not simply storing TEXT fields in the data table are: • Performance: When searching over non-indexed fields in the data table, huge texts in that table would slow down the search. (On the other hand, this design slows down the display of one single record, since multiple records need to be read from the database just to display a single record. Nonetheless, the database design is a good compromize between fast search and fast record display.) • Compactness: Every text would have to be stored three times if it were not stored in a separate table: once in the data table and two times in the history. Text records consist of the following information: • Id: Id of the text entry; used to reference texts from the data as well as from the history tables. • Text: Text E.4.4 Transactions RETE-DB does not know about transactions. This has the advantage of high performance, but it also has some disadvantages when multiple users change a record at the same time. Export/Import: When a user exports some records to a spreadsheet application (e.g. at 10:00 am), modifies the data there and imports the records afterwards back to RETE-DB (e.g. at 11:30 am), this user might unintentionally overwrite changes done by other users during that time (between 10.00 and 11:30 am). To avoid this problem, a user needs a special right to overwrite records by an import. The administrator should give this right only to users who know about these problems or to users who have very limited write access and therfore can not overwrite changes done by others. E.4. DATABASE DESIGN 105 Simultaneous changes via a browser: When two users change a record at the same time, the second user who sends the update request will overwrite all modifications of the first user. Even fields that were not modified by the second user will be reset to their original value if the first user changed them. The risk of a second user overwriting the values of the first can be reduced by limiting the write access rights of every user to the necessary minimum. Should this case happen nonetheless, the second user will notice that more fields were changed than intended. The user can see the earlier changes in the history and undo the unintended modifications. Extremely rare situations: Supposed, two users press the submit button at the exact same time. Then it can happen that the history is partly inconsistent: • Two history entries might have the same timestamp. • The order of the history entries might be different from the order of the actual changes. This means that the actual value of a record might be logged in the second-latest history entry. • The displayed ’old value’ might be wrong. • There is a hidden and unused feature in RETE-DB, that logs not only the date of a change in the history but also the time intervals without change (see E.4.2). These time intervals might overlap. Unexpected errors: If the RETE-DB servlet is terminated or encounters an unexpected error, the following things can happen: • The latest history entries might be missing. • Some texts exist in the database but are not referenced. This is not a problem only a waste of memory. • Some uploaded files might exist but are not referenced. This is not a problem only a waste of memory. Conclusion: • It might occur, that one user overwrites changes of another user by accident if both users modify a record at the same time. • Some very unlikely situations produce small inconsistencies in the history. For most applications, these problems are acceptable: Data is not modified without cause, every change is logged in the history (except if the servlet is terminated in the right millisecond), access rights are not compromized. 106 APPENDIX E. DESIGN E.5 Design of Request URLs The request URLs (Uniform resource locators) are defined in such a way that • No URL should exceed the 1024 byte limit. (This cannot be guaranteed) • A user can bookmark any URL or send it to someone else so that the same page will be visible when the URL is requested again. E.5.1 find Parameter In general, a query URL contains a phrase like ”...find=a2o3e...”. The first a says that the criteria of the different columns shall be connected by an AND operator. Replace the ”a” by an ”o” to connect the criteria of the different columns by OR. Or prepend an ”n” in front of the ”a2o3e...” query to get all results that do not match the specified criteria (n=NOT). The digit 2 says that there are 2 columns that are connected by AND. The o3 says that there are three criteria on the first column that are logically connected by an OR. Note: • The NOT operator might produce unexpected results when applied to TEXT, DATE and TIME fields due to possible NULL values. E.6 Errors Table ’rete db meta.accs users data’ doesn’t exist: You get a ”java.lang.RuntimeException: java.sql.SQLException: Table ’rete db meta.accs users data’ doesn’t exist” if you delete the database while RETE-DB is running. In this case you need to restart the RETE-DB servlet. No such file or directory: You get a java.lang.RuntimeException: java.io.IOException: No such file or directory exception if either the FileUpload TempFolder in the web.xml file does not exist or is write protected or if the Archive Folder of the project does not exist or is write protected. Login impossible or changing data does not work: These effects may occur if your harddisk is full or if the MySQL database file has reached the maximum file size of your filesystem. E.6. ERRORS 107 2 history entries modified instead of 0 or 1: This effect may occur if one record is modified by two different tasks at the same time. See E.4.4. Unexpected: Either the system user has limited access rights or nothing has to be done in Dispatcher.doAutomaticChanges(): This might occur if the admin-group 0 does not have access on a field for which a consistency check is defined. Please check the access rights on the fields. sun.io.MalformedInputException: Missing byte-order mark: When importing a csv file in unicode (UCS-2) format, check that this file begins with the unicode character FEFF to identify the byte order in the file. java.lang.RuntimeException: java.sql.SQLException: Syntax error or access violation, message from server: ”You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ’()’ at line 1” de.quartztime.RETE DB.security.DBStatementWrapper.executeQuery (DBStatementWrapper.java:439) Add the following lines to your web.xml file: <init-param> <!-- Does the UTC TIMESTAMP() command exist? This should be ”false” for MySQL 3.x or 4.0.x databases, ”true” or undefined for MySQL 4.1.1 and newer. --> <param-name>Database UTCTimestampAvailable</param-name> <param-value>false</param-value> </init-param> Other Errors: Please feel free to write an email to [email protected] in case of problems. Index **** **** **** **** **** **** **** Black on Light Color, 39 Black on White, 39 Bold Black on Light Color, 39 Bold Black on White, 39 Bold/Original Colors, 39 Hidden, 39 Original Colors, 39 csv, 24, 26 Custom Query, 106 data export, 26 import, 24 DATE, 36 date format, 15 debug, 77, 106 Default Access, 48 distribute, 66 dropdown box options, 41, 43 access control, 48 access rights, 48 account create, 57 disable, 58 ACCS, 102 ACL , 36 ACL Admin Access, 40 ACL Wide Input, 39 Administration, 31 AND, 21 TM Apache Tomcat , 75, 79 Archive Folder, 33 Auto Type, 40 automatic changes, 100 email notifications, 43, 75 Entry Disabled, 44 error, 106 exception, 106 explain, 15, 20 export, 24 favorites, 23 field, 32 create, 36 delete, 41 Field Name, 36 Field Type, 36 FILE, 36 find=a2o3e, 106 Firefox, 10, 79 Foreign Project, 36, 38 Form Layout, 39 Form Order, 39 back-up, 64 recover, 64 bookmark, 23 browser, 10 Checklist, 61 color, 39, 81 consistency checks, 100 Consistency Type, 40 cookies, 10 copy, 17 Created Time, 40 GR P, 36 Ground Color, 39, 81 108 INDEX 109 r MySQL , 70, 72, 79 replicate, 66, 101 group create, 52 delete, 56 modify, 56 group member, 59 NOT, 21, 106 Nto1, 36, 38, 39 Nto1 Wide Input, 39 history, 19 ID , 36 import, 26 Index, 36 create, 66 info, 17 install, 69 INT , 36 Internet Explorer intrusion avoid, 64 detect, 65 OR, 21 order, 21 r , 10, 79 Jakarta, 75, 79 KEYW, 32, 36, 41, 43 keyword, 32, 41 create, 43 delete, 44 Last Modification Time, 40 LDAP, 52, 57, 73 list, 21 List Layout, 39 List Order, 39 local time, 30 log, 19 login, 10 Login Disabled, 58 logout, 12 Maintenance, 63 Mandatory Fields, 40 member, 59 MULT, 32, 36, 41, 43 MULT Narrow Input, 39 multiple choice options, 41, 43 pages, 21 PASS, 36 password change, 12, 73 performance, 65 permissions, 48 process, 100 PROJ, 36 project, 14, 32 create, 33 delete, 35 query, 21 bookmark, 23 export, 24 Read Access, 48 Read DBs, 33 REAL, 36 record copy, 17 create, 15 create right, 48 default access, 48 delete right, 48 export, 24 history, 19 import, 26 info, 17 modify, 20 search, 21 replicate, 66 restart, 76 RETE-DB 110 INDEX move, 64 restart, 76 unlock, 65 RuntimeException, 106 create, 57 delete, 58 User Manual, 9 utc, 30 r Safari , 10, 79 scalability, 101 search, 21 bookmark, 23 export, 24 Search Disabled, 44 security, 101 server load, 65 distribute, 66 enhance performance, 66 speed, 65, 101 spreadsheet application, 24, 26 SQLException, 106 system performance, 65 virus, 65 Table Prefix, 33 TEXT, 36 Text Color, 39, 81 TEXT HTTP-Link, 39 TIME, 36 time format, 15 TIME Created, 40 TIME LastMod, 40 timezone, 30 change, 12 Transactions, 104 troubleshooting, 77, 106 TX** Mandatory, 40 TX16, 36 TX32, 36 TX80, 36 TX80 Narrow Input, 39 TXCC, 36 TXCC Narrow Input, 39 unlock, 65 URL, 106 user web.xml, 73 workflow, 100 Write Access, 48 Write DB, 33 xml, 24