oasis_archiv


Middleware installation and configuration

Preconditions

  • Apache with working PHP4 or PHP5 running under user „apache“ and group „apache“.
  • PHP-CLI accessible through /usr/bin/php
  • Standard UNIX utilities accessible from PHP using exec() function. This includes:

cp, flock, grep, sort, sed, cut, tac, head, tail, nl, join, sh

  • A directory writable by apache user or apache group eg. /tmp/oasismw-cache
  • HTTP or HTTPS connection to DB-Adapters.
  • JAVA 1.4+ available during development process. (used by saxon XSLT processor)


Installation

  • Extract the ZIP archive to the WWW directory of Apache eg. /var/www/OasisMiddleware
  • Change value of MIDDLEWARE_DIR constant in file config/conf_middleware.php which should refer to the directory writable by apache user. The repository of middleware will be created there later.
  • Edit the script utils/setup.sh to match your current setup of DB-Adapters changing the lines starting with add_dbadapter.php
  • Make sure that all scripts in utils directory have been made executable. You may use chmod u+x utils/*
  • Run the setup script using ./utils/setup.sh, which initializes the repository. Afterwards, a directory structure will be created in the path defined by the MIDDLEWARE_DIR constant.
  • It is possible to delete the directory develpment/ which contains data and tools used during the development process and the source file oasis-attributes.xml explained later.


Main Configuration Items

All important counstants concerning OasisMiddleware configuration can be found in config/conf_middleware.php.

Bild:MW Config.jpg

Customization of OASIS Attributes

The definition of all OASIS attributes is located in XML format in file development/database/oasis-attributes.xml. There is an application mini-compiler available for the developers, which allows to generate several files used by the Middleware. These files cannot be edited manually. Mini-compiler could be launched either directly from the web browser or using PHP-CLI:
php development/compile/compile_oasis_attributes.php
The compiler invokes the SAXON [Ref. 1] XSLT [Ref. 2] processor written in Java. All files generated by the compiler are described in the picture .
Each modification to the XML file development/database/oasis-attributes.xml requires recompilation of depending files. The typical cases includes but are not limited to:

  • localization of labels, descriptions, enumeration values of particular attributes
  • changing the sortable flag of an attribute
  • changing the queryalias parameter, which allows to use multiple aliases for an attribute.



Runtime configuration and debugging

The directory utils/ contains directly executable PHP scripts explained below: add_dbadapter.php <dba_id> <base_url> <description>
Permits the registration of a new DB-Adapter instance in Middleware. A short, cogent and explicit identifier, under which cached results will be stored, is used as a parameter. For each work, this identifier will be inserted as a prefix in the attribute “provenance” e.g. dba_id=ciant, provenance=ciant => provenance=ciant_ciant
The second parameter is URL which makes DB-Adapter accessible via HTTP interface. The third parameter is optional and is used for subsequent description of the DP-Adapter instance.
delete_dbadapter.php <dba_id>
Permits to check out the DB-Adapter instanciu from Middleware. The identifier mentioned in the previous command is used as a parameter.
cleanup_outdated_requests.php
Permits a single-shot switch-over of the entire Middleware repository (cache hierarchy) and clearing of out-of-date requests which were not deleted in the end of a request. It is appropriate to start up this script in precisely chosen intervals e.g. with the help of the CRON service.
process_pending_search.php [load|search]
The script serves for debug purposes. It allows running suspended search or loading asynchronous operations (in case of need both of them at the same time). We can use it e.g. after a forced shutdown of some of the running search or loading operations.
rebuild_cache.php
Allows one to erase all the runtime data from middleware including all cache and information about registered DB-Adapters. It also permits automatic reinitialization to the original state according to the configuration script.
show_current_queries.sh
Returns list of search queries found in middleware repository.


Runtime statistics

As an additional tool for administration purposes, middleware provides a simple framework for creating statistical interfaces using graphs. This version provides only a single graph representing the amount of cached data for active requests. It is possible to add more functionality in the future, which is quite simple because of the powerfull jsgraph library.
The current statistical tool is located at:



Deadlock prevention in the Middleware

Middleware repository is a centralized data storage which is concurrently accessed by the mechanisms of frontend and asynchronous processes. This is why the locking of shared data structures had to be secured in order to prevent it from race conditions [Ref. 3].
In an environment, where locking of at least two sources by at least two processes is possible, the dreadlock [Ref. 4] threat emerges automatically. Deadlock example:
R1 locked by A, R2 locked by B, A waiting for R2, B waiting for R1 There are several different approaches to solving this problem including ignoring it. However we have opted for a simple and efficient solution based on partial ordering of resources [Ref. 5].
This approach belongs to the so-called DEADLOCK PREVENTION [Ref. 4] approaches. The principle lies in attacking the condition „Circular wait“ so that each shared source is labeled with a number. If a process wants to lock a resource R, then previously it had to unlock all previously locked resources denoted by number greater than R. Such partial ordering [Ref. 5] ensures that a situation in which the operations would wait in a cycle will never occur.


References

[Ref. 1] M. H. Kay, SAXON - → The XSLT and XQuery Processor, 2007. [Ref. 2] W3C, XSL Transformations - → XSL Transformations, 1999. [Ref. 3] Wikipedia, Race condition - → Race Condition, 2007. [Ref. 4] Wikipedia, Deadlock definition - → Deadlock definition, 2007. [Ref. 5] Wikipedia, Partially ordered set - → Partially ordered set, 2007. [Ref. 6] Wikipedia, Model-view-controller - → Model-view-controller, 2007. [Ref. 7] Wikipedia, ISO. List of ISO 639-1 codes - [http://en.wikipedia.org/wiki/List_of_ISO_639- 1_codes → ISO], 2007. [Ref. 8] D. Bednárek, D. Obdržálek, J. Yaghob, and F. Zavoral, Data Integration Using DataPile Structure - [http://www.uivt.cas.cz/semweb/download.php?file=05-10- Bednarek&type=pdf → DataPile Structure], 2003.


 

An article by Viliam Slimko


 

→ Back to OASIS Database Adapter

→ Back to OASIS Middleware

→ Back to OASIS Platform

  Login