# MPSCD - MPS Configuration Data access library

The MPSCD Python library allows the user to access and modify the MPS configuration database (SQLite) in a safe and 
controlled manner. It provides the functions to create, retrieve, modify, and delete all the existing database objects. 
In addition, it secures the database by doing consistency and validation checks.

## 1. Description
The basic idea behind the library is to separate the data access, validation, and consistency methods from the 
definition of the database objects themselves. This allows to modify or substitute the database without 
rewriting any data access logic. To reflect that, the library is divided into different folders according to 
functional scopes:

- **docs/** (documentation)
- **src/** (library code)
- **tests/** (unit tests and testing database)

The **src/** folder is further divided:

- **dal/** (code related to the modification of the database)
- **model/** (code related to the representation of the objects stored in the database)

The **dal/** folder contains code that provides a generic way to access any database object. 
It also contains the basic validation logic associated with the underlying storage. 
No specifics about the database or stored objects is implemented here. DAL object declarations for specific databases 
are placed in sub-folders (at the moment there is only the **configuration** sub-folder).

In the **model/** folder we have the code related to the objects stored in the database - the objects metadata. 
There are 2 different base objects that every database backed objects must inherit from 
(in order to provide common functionality and basic data validation). 
Configurations of metadata for different databases are placed in sub-folders 
(at the moment there is only the **configuration** sub-folder).

The **docs/** folder is further divided:

- **api_reference/** (API references that is automatically generated)
- **static/** (Static, manually produced documentation)
- **test_coverage/** (Unit Test code coverage report, automatically generated)

Since there are potentially many different users of the library, the **docs** folder 
has all the available material related to the library and database, 
including the Developer's guide, API reference, User's guide etc.

## 2. Setup
In order to start using the library you need to install it on the target machine. The development process involves 
some additional libraries as well - this libraries are **not required** for only using the MPSCD library 
(but it is suggested you use them for development). For additional information about this libraries and the setup 
in general consult the [Developer's Guide](#).

To install the library run the following command in the **root** folder of the project:

<pre><code>
sudo python setup.py install
</code></pre>

To test if the installation was successful you can execute
this command:

<pre><code>
python -c "import MPSCD; print MPSCD.__name__"
</code></pre>

The expected output is the string **MPSCD**. If this is not the case, there was an error with the library installation.
If there are no error displayed you successfully installed the library in your default Python **site-packages** folder.
You can start using the library (see chapter **Usage**).

### 2.1. Installation location
The installation location is site dependent. There are 2 folders that need to be specified in order to place the 
library in the desired location:

- install-lib: location where the library files are deployed.
- install-scripts: location where executable scripts are deployed.

"install-lib" should be part of your PYTHONPATH (environment variable). This will allow the modules to be imported 
in your python scripts. It is also a requirement to run the scripts that depend on the library.

"install-scripts" should be part of your PATH (environment variable). This is not required to run the scripts, 
but is advisable if you want to be able to execute them from the terminal in any location.

Example:

<pre><code>
python setup.py install 
--install-lib=/afs/slac/g/lcls/tools/python/python2.6.4/slac-packages 
--install-scripts=/afs/slac/g/lcls/tools/python/python2.6.4/bin
</code></pre>

## 3. Documentation
All the available documentation is located in the **docs/** folder of the project. Some documentation is static but 
most of it is auto-generated from the source code.

The detailed material is divided into 2 documents based on the target audience:

- [User's Guide](#) (Detailed information on how to use the library)
- [Developer's Guide](#) (Detailed information on how to developer software on top of the library)

### 3.1 README file
The HTML version of this README file is generated automatically from the markdown file **README.md** in the **root** 
folder of the project. To generate this file, you need to install markdown2 on the target machine:
[https://github.com/trentm/python-markdown2](https://github.com/trentm/python-markdown2)

In the root folder of the project run the command:

<pre><code>
markdown2 README.md > docs/README.html
</code></pre>

The README will be generated and written in HTML form to the **docs/README.html** file.

### 3.2. Object model
<b>(Available <a href="object_model.html" target="_blank">here</a>)</b>

The object model documentation is generated from code. To generate the documentation, run the **gen_docs.py** script 
from the **root** folder of the library:

<pre><code>
python gen_docs.py > docs/object_model.html
</code></pre>

The documentation will be written in HTML form to the **docs/object\_model.html** file.

### 3.3 API reference
<b>(Available <a href="api_reference/help.html" target="_blank">here</a>)</b>

The API reference is built using **Epydoc**. If you want to generate the API reference you will have to install 
Epydoc on the target machine:
[http://epydoc.sourceforge.net/](http://epydoc.sourceforge.net/)

In the root folder of the project there is already a configuration( **epydoc.cfg** ) file for generating the reference 
in the correct format. To generate the reference, execute the following command in the **root** folder of the project:

<pre><code>
epydoc --config=epydoc.cfg
</code></pre>

The API reference will be generated and written in HTML form to the **docs/api\_reference** folder. 
Start browsing the reference at **docs/api\_reference/index.html**.

### 3.4 Unit tests code coverage reports
<b>(Available <a href="test_coverage/index.html" target="_blank">here</a>)</b>

**Package**: tests

To facilitate the testing using **nose** is suggested (but not mandatory): 
[https://nose.readthedocs.org/en/latest/](https://nose.readthedocs.org/en/latest/)

#### 3.4.1 How to run tests
To run the tests go to the **tests/** folder and execute:

<pre><code>
nosetests -v --with-coverage --cover-branches --cover-package=src
</code></pre>

All tests will be executed. The tests, branch, and code coverage reports will be displayed in the console. 

**WARNING:** All tests should pass at all time. If this is not the case, **do not use** your current 
library version for production purposes.

#### 3.4.2 Generating coverage report
If you want to produce code coverage reports run the following command from the **tests/** folder:

<pre><code>
nosetests -v --with-coverage --cover-branches --cover-package=src --cover-html --cover-html-dir=../docs/test_coverage
</code></pre>

The code coverage report will be generated and written in HTML form to the **docs/test\_coverage** folder.
Start browsing the reference at **docs/test\_coverage/index.html**.

## 4. How the generic DAL works
**Module**: src.dal.MpsGenericDal

The generic dal takes as input the list of database objects and the database connection. From the list of database 
objects it generates CRUD (Create, Read, Update, Delete) methods for each class in the following format:

<table>
    <tr><td>    <b>Functionality</td><td>               <b>Name pattern</b></td></tr>
    <tr><td>    Create new object</td><td>              add_[ClassName]</td></tr>
    <tr><td>    Read object from database</td><td>      get_[ClassName]</td></tr>
    <tr><td>    Update object in database</td><td>      update_[ClassName]</td></tr>
    <tr><td>    Delete object from database</td><td>    delete_[ClassName]</td></tr>
</table>

The **add** and **update** generic methods share the same core concept and validation:

1. Verify if the object we are trying to save is of valid type.
2. Verify the object data integrity (Validate object attributes, Verify if object is already in database, 
Verify object relations).
3. Get the SQL query from the object instance (generated by methods in the base object).
4. Execute the query on the database.
5. Update the cache, if in use (see *Cache* chapter for more details).

The **get** and **delete** methods are similar too:

1. ( **delete only** ) Verify if at least one unique parameter of the object is defined in the desired delete query - 
for security reasons we do not allow the bulk deletion of objects.
2. Convert provided parameters in an SQL query.
3. Execute the query on the database.
4. ( **delete only** ) Update the cache, if in use (see *Cache* chapter for more details).

The generic dal also takes care of mapping the result set from the database to class instances. It does so by 
using the configuration provided for each class (more details in the **Model** chapter) and by reading the column 
names from the result set from the database.

### 4.1. Object data integrity
**Module**: src.dal.CrudValidation

When performing database modifying actions (add and update) the object data needs to be validated before the changes 
are commit to the database. This is done in 3 steps:

1. Validate object attributes
2. Verify object data consistency
3. Verify object relations

The purpose of this steps is to maintain data integrity in the database, even if the database itself is not configured 
correctly. This should allow the library to work on any version of the database, even on historic ones that do not 
yet implement all the latest constraints, without risking to corrupt any data.

#### 4.1.1. Validate object attributes
The attribute validation is done in the **src.model.BaseObject** module. The idea is to verify if:

- Unique identifier of the object is set (unique\_value, see chapter **Model** for more details).
- Mandatory relations are not NULL, meaning that all the essential attributes are set on the object.
- Specified relations on the object have the correct class type, even if they are not mandatory.

#### 4.1.2. Verify if object is already in database
When verifying if an object is already present in the database we do some additional check to verify data integrity:

- The specified object has id and/or unique attribute specified. If not, such object is not verifiable.
- Is there more then 1 object in the database with the same id or unique\_value. This means the database is corrupted.
- If there is no object with the specified attributes, then the object does not exist in the database - return False.
- If the provided id is not the same as the id from the database (which was retrieved using the unique\_value) the 
object is invalid because it violates the uniqueness constraint (see **Model** for more details).
- If all other tests are passed, the object exists in the database and the provided object is valid - return True.

#### 4.1.3. Verify object relations
When verifying object relations we want to do verify if every relation of our object exists in the database. To 
achieve this we use the previously discussed method (see chapter **Verify if object is already in database**). 
For every relation we verify the following conditions:

- If the relation is not mandatory and its value is NULL, stop further verification. 
- Verify if relation already exists in database. If not, this is a data consistency error. The verification fails.
- Retrieve the relation object from the database and assign it to the object we are verifying.

Retrieving the relation we are verifying from the database and assigning it to the object we are verifying allows us to 
assign relations without specifying all of their attributes. For example:

<pre><code>
device = dal.get_Device(id=1)
device.device_area = DeviceArea(name="Dump")            # To use a relation, we need to specify id or unique value.
device.device_type = DeviceType(id=1)                   # Example with id.
</code></pre>

Each relation need only one attribute that uniquely identifies it (id or unique\_value). This mechanism is not related 
to caching (since the relation object will still be retrieved from the database), but can server a similar purpose in 
simplifying the library usage.

### 4.2. Cache
**Module**: src.model.CachedCodeListBaseObject

Caching for code list objects is implemented by using the extended base object called **CachedCodeListBaseObjects**. 
The library takes care of caching all the values of all entities that extend this class. The values are accessible 
as static attributes of the class extending the base object. The name of the attribute is the unique value of each 
entry in the database, sanitized in such a way that it forms a valid attribute name.

The sanitation is done by:

- Replacing white spaces with underscores '\_' ("Sample value" \-> "Sample\_value")
- Removing all non alpha numeric characters. ("T@rget!" \-\> "Trget")
- If the unique value starts with a number, place an underscore '\_' in front of it. ("10ns" -> "\_10ns")

You can simply use the cached objects as any other object retrieved from the database.

<pre><code>
DeviceType.Link_Processor == dal.get_unique_DeviceType(unique_value = "Link Processor")
</code></pre>

All the code list objects are cached upon instantiation of the DAL. The constructor of the DAL has the parameter 
**cache\_code\_lists** which specifies if the caching is used. The cached values are only available if this 
attribute is set to **True**(default is True). It is highly recommended to use the cache since the initial overhead 
is minimal and the ease of usage of the library improves dramatically.

The **CachedCodeListBaseObjects** together with the **MpsGenericDal** takes care of invalidating, cleaning and 
reloading the cache when needed. Only the changed classes are reloaded in order to assure optimal performance.

### 4.3 SQL Validation
**Module**: src.dal.Validator

As an added layer of security, the user can create SQL scripts to check properties of the database after 
a CRUD modifying action. The root directory of these scripts is abstracted as a Validator object and the  
SQL scripts are executed via a call to the script_validator function.


#### 4.3.1 Validator Object
The validator object contains the location of the SQL validation scripts, the database, and 
the cached paths of scripts that have already been executed.
This object contains the following functions

- get_scripts: finds the paths of all SQL scripts in a specified directory  with a certain name, this name is related
               to the CRUD action (ie// 'update*.sql')
- run_script: reads a single sql script, separates it  by ';' then executes each command in the script 
              raises a validation error
- is_script: checks whether the script name matches the specifications
- refresh_script: store the script name and the set of paths associated with it in a dictionary
                  if those values are not already stored

#### 4.3.2 Validation Method
Each modifying action is wrapped with the script_validator function. This function relies on the validator object
to hold all information of where the SQL scripts and database exist. It also calls the validator object functions
to do the following commands below.

- Interpret the name of validation SQL script (mainly checks the 'all' case)
- Get scripts corresponding to that name, then cache them if needed
- Call wrapped function (the CRUD modifying action)
- Execute cached SQL scripts against database

## 5. Model
The model is setup in a way that adding new entities should be relatively easy. One of the design goals was also to 
decouple the model declaration from the underlying database access code. For this reasons, all model objects must 
inherit from **BaseObject** (or from **CachedCodeListBaseObjects** if you want this class to be cached. See Cache 
chapter for more information).

### 5.1. Adding objects to model
Each model class must declare the following static values that represent its metadata:

- **\_database\_table** (Name of the database table where this class maps)
- **\_unique\_attribute** (Tuple that maps the unique attribute name with the unique database field)
- **\_relations** (Dictionary that maps the attributes to the relation details)
- **\_attributes** (Dictionary that maps the attribute names to the table columns)

After the following values have been declared, the constructor of the base object should be called in order to 
initialize all the provided metadata.

Example:

<pre><code>
# The class extends the BaseObject, this means it will not be cached.
class Device(BaseObject):

    # The data for this class is stored in the "zdevice" table.
    _database_table = "zdevice"
    
    # The unique attribute of this class will be the attribute "name", that is stored in the column "ZNAME".
    # The unique attribute needs to be declared in the init method as well. See the Device._attributes.
    _unique_attribute = ("name", "ZNAME")
    
    # The class can be constructed by providing the id or name, but they are not mandatory.
    def __init__(self, id=None, name=None):
    
        # The list of relations (or foreign keys) this class has. The format is the following:
        # "attribute name": (RelationClass, "column name", [True/False])
        # [True/False] denotates if this relation is mandatory or not (non nullable vs. nullable)
        Device._relations = {
            "device_detail": (DeviceDetail, "ZDETAILS", False),
            "device_type": (DeviceType, "ZTYPE", True),
            "device_area": (DeviceArea, "ZDEVICEAREA", True),
            "pv_device_type": (PvDeviceType, "ZPVDEVICETYPE", True),
            "pv_area": (PvArea, "ZPVAREA", True)
        }

        # The list of attributes a device has. The format is the following:
        # "attribute name": "Column name"
        Device._attributes = {
            "name": "ZNAME",
            "pv_position": "ZPVPOSITION"
        }

        # Call the constructor of the BaseClass. Pass the id parameter (not mandatory)
        super(Device, self).__init__(id)
        
        # Set any attributes passed in the constructor, do other initialization etc.
        self.name = name 
</code></pre>

#### 5.1.1. Database table
**(Mandatory)**

This attributes declares in which table of the database the data for this class will be stored. It should be set as a 
static/class attributes. It is of type **str**:

<pre><code>
_database_table = "table name"
</code></pre>

### 5.1.2. Unique attribute
**(Mandatory)**

This attributes declares which attribute in the class and which column holds the unique value for this class. 
A unique attribute is an attribute that is unique in the entire system for a specific type of object. 
It should be set as a static/class attributes. It is a tuple:

<pre><code>
_unique_attribute = ("attribute name", "column name")
</code></pre>

A unique attribute can be **a relation or an attribute** (unique attributes are more common). If the class does not have 
a unique attribute (i.e. there is no attribute that uniquely identifies an entity) you must use its id in 
the following way (this example is true for the MPS Configuration database, where the id column is called "Z_PK"):

<pre><code>
_unique_attribute = ("id", "Z_PK")
</code></pre>

### 5.1.3. Relations
**(Optional)**

A class can have zero or more relations with other classes. Each relation class needs to be a valid model object as well.
The relations are declared as a dictionary, where the key is the name of the attribute. Relations are initialized 
in the constructor of the class, even if they are static attributes. This is done to work around the circular 
dependency problem in the dependency tree.

<pre><code>
"attribute_name": (RelationClass, "Relation column", True/False),
</code></pre>

The keys of the dictionary (attribute\_name) need to be a valid attribute name in Python (alpha numeric characters and "\_" 
only, first character cannot be a number). A relation can always be the objects unique attribute. If this would be the 
case for the example above, the **\_unique\_attribute** would be declared as:

<pre><code>
_unique_attribute = ("attribute_name", "relation column")
</code></pre>

### 5.1.4. Attributes
**(Optional)**

A class can have zero or more attributes. The basic attributes, shared by all objects, are declared already in the 
**BaseObject**. Attributes are class static attributes and they can be declared anywhere, but for consistency we 
declare them with the relations in the class constructor. Attributes are declared as a dictionary, where the key 
is the name of the attribute.

<pre><code>
"attribute_name": "attribute column",
</code></pre>

The keys of the dictionary (attribute\_name) need to be a valid attribute name in Python (alpha numeric characters and "\_" 
only, first character cannot be a number). An attribute can always be the objects unique attribute.

### 5.2. BaseObject
**Module**: src.model.BaseObject

### 5.3. CachedCodeListBaseObject
**Module**: src.model.CachedCodeListBaseObject

## 6. Usage
Before continuing with this chapter is mandatory that the library was successful installed on the target 
machine and that you have a test MPS configuration database. One is provided in the **tests/** folder, but this one
**must not** be modified, because test cases relate directly to data in this database. You can, however, make a copy
of it and use it to test the code in this chapter.

**WARNING**: Please note that this statements are database dependent. They might not return any data or errors may 
 be thrown when used on different databases. Modify the statements according to the data stored in your specific database. 

### 6.1. Import library
The basic entry point for the MPS Configuration database is the package **MPSCD.dal.configuration**. It is suggested 
that you import the entire package since it automatically imports all the classes you will need. You can import 
this package by executing the following statement.

<pre><code>
from MPSCD.dal.configuration import *                       # Import the MPSCD library
</code></pre>

### 6.2. Connect to database
The main class for interacting with the database is **MpsConfigDal**, located in the 
**MPSCD.dal.configuration.MpsConfigurationLibrary** module. The class takes the path to the MPS Configuration database
in the constructor.

<pre><code>
dal = MpsConfigDal("path_to/MpsConfigDatabase.mps")        # Connect to the MPS database
</code></pre>

### 6.3. Add objects to database
Adding objects to the database is the most time consuming process. You must specify all the properties and relations 
that the object you are adding needs. For at least facilitate this process, object caching was implemented (see chapter 
**Cache** for more details). The following examples use the both mechanisms to demonstrate their usage. 
To add objects to the database use the **add\_[ClassName]** methods. The add methods take as argument the object we 
are want to add.

<pre><code>
new_device = Device()                                                       # Create new device instance
new_device.name = "shiny thing"                                             # Unique attribute of this device
new_device.pv_position = 1                                                  
new_device.device_type = DeviceType.FakeDeviceType                          # Cached object instance use
new_device.device_area = dal.get_DeviceArea(unique_value="Undulator")[0]    # Classic get by unique value
new_device.pv_device_type = PvDeviceType.DUMP
new_device.pv_area = PvArea.HFP
dal.add_Device(new_device)                                                  # Add the device to database
new_device_id = new_device.id                                               # The add method assigned the id
</code></pre>

The add method always assigns the **id** value to the saved object. This value cannot be specified manually, because 
it is assigned by the database. If this value is specified, it will be ignored.

### 6.4. Get objects from database
You can retrieve objects from the database by calling the **get\_[ClassName]** methods. You can retrieve all objects 
(by not specifying any parameter), or a specific object by specifying either its id (id=[id of object]), or its 
unique value (unique\_value=[object unique value]), or by specifying its id and unique value at the same time. 
For more details about unique values see the **Model** chapter.

<pre><code>
all_devices = dal.get_Device()                                  # Retrieve list of all devices
first_device = dal.get_Device(id=new_device_id)[0]              # Retrieve new device by its id
unique_device = dal.get_unique_Device(id=new_device_id)         # Retrieve a unique device from the database.
test_device = dal.get_Device(unique_value="shiny thing")[0]     # Retrieve new device with name="shiny thing"
</code></pre>

The **get\_[ClassName]** method always returns a list of objects. In case you are retrieving your desired object 
by id and/or unique\_value, the object will always be the only and first item in this list (see example above). The 
**get\_unique\_[ClassName]** methods have the same signature as the get\_[ClassName] methods, but they always return 
exactly one object. If there are more then one or none, a ValueError is thrown.

### 6.5. Update objects in database
You can update existing object using the **update\_[ClassName]** methods. Before updating objects in the database 
you must retrieve them. This is not mandatory - you could fill in all the data related to the object manually, 
but this process is error prone and time consuming. The suggested way is to retrieve the object from the database 
first, modify it, and save it back.

<pre><code>
device = dal.get_Device(unique_value="shiny thing")[0]
device.name = "old broken machine"                          # Change device name
dal.update_Device(device)                                   # Update the record in the database
</code></pre>

Even if, as stated before, the **id** value is assigned by the database, it is still possible to modify the id of 
an object and update this object in the database. By doing so, you effectively do a "copy - paste" of the retrieved  
object over another existing item in the database (but first you have to modify its unique value). The usage of 
this functionality should be very limited in order to minimize the risk of unintentional data overwriting.

### 6.6. Delete object from database
For deleting objects from the database use the **delete\_[ClassName]** methods. They work very similarly to the 
**get\_[ClassName]** methods, but do not allow you to delete multiple object at the time (you always have to specify 
id and/or unique value of the object you want to delete).

<pre><code>
dal.delete_Device(id=new_device_id, unique_value="old broken machine")  # Delete our device
</code></pre>

You don't have to specify both **id** and **unique\_value** at the same time, but it is good practice to do so. 
This should prevent accidental deletion of data.

### 6.7 Get all possible unique values for an object
Is it possible to retrieve all the unique values for a specific object. This is meant to facilitate the creation 
of suggestions, drop down menus etc. in higher level applications. It is also useful if you are not sure of all 
the possible values of an object.

<pre><code>
dal.all_unique_values(Device)                               # Get the list of device names.
</code></pre>

### 7. Examples
The following are complete examples of the most common operations performed on the MPS configuration.

#### 7.2. Modify device name
Get a device from the database by name. Modify the name, and update the database.

<pre><code>
from MPSCD.dal.configuration import *
dal = MpsConfigDal("MpsConfigDatabase.mps")
device = dal.get_Device(unique_value="Old name")

device.name = "New name"                                    # Change device name.
dal.update_Device(device)
</code></pre>

#### 7.3. Change device type
Get a device from the database by name. Modify its type, and update the database.

<pre><code>
from MPSCD.dal.configuration import *
dal = MpsConfigDal("MpsConfigDatabase.mps")
device = dal.get_Device(unique_value="Device name")

device.device_type = DeviceType.Link_Processor              # Change device type.
dal.update_Device(device)
</code></pre>

#### 7.4. Remove device and its associated Fault
Get a device from the database by name. Delete its fault and the device itself.

In order to do that, one must delete all the device related objects manually. The base DAL library does not allow cascade 
deletes. Cascade deletes are however implemented in higher levels to simplify the usage of the library. The example 
below showcases how the deletion should be done manually.

<pre><code>
from MPSCD.dal.configuration import *
dal = MpsConfigDal("MpsCofigDatabase.mps")
device = dal.get_Device(unique_value="Device name")

device_detail = dal.get_DeviceDetail(id=device.device_detail.id)[0]     

if device_detail.external_pv is not None:                               # ExternalPv related to DeviceDetails,
    dal.delete_ExternalPv(id=device_detail.external_pv.id)              # but it is not mandatory. Check if exists.

dal.delete_LinkNodeChannel(id=device_detail.link_node_channel.id)       # LinkNodeChannel relates to DeviceDetails.

dal.delete_DeviceDetails(id=device.device_details.id)                   # DeviceDetails relates to Device.

dal.close()                                                             # Close the connection to the database.
</code></pre>

## 8. Licence
<pre><code>
/*
**
**                                Copyright 2004
**                                      by
**                         The Board of Trustees of the
**                       Leland Stanford Junior University.
**                              All rights reserved.
**
**         Work supported by the U.S. Department of Energy under contract
**       DE-AC03-76SF00515.
**
**                               Disclaimer Notice
**
**        The items furnished herewith were developed under the sponsorship
**   of the U.S. Government.  Neither the U.S., nor the U.S. D.O.E., nor the
**   Leland Stanford Junior University, nor their employees, makes any war-
**   ranty, express or implied, or assumes any liability or responsibility
**   for accuracy, completeness or usefulness of any information, apparatus,
**   product or process disclosed, or represents that its use will not in-
**   fringe privately-owned rights.  Mention of any product, its manufactur-
**   er, or suppliers shall not, nor is it intended to, imply approval, dis-
**   approval, or fitness for any particular use.  The U.S. and the Univer-
**   sity at all times retain the right to use and disseminate the furnished
**   items for any purpose whatsoever.                       Notice 91 02 01
**
*/
</code></pre>