Wanjuan Yang
January 5, 2007
CCP4i DB handler is a server application. It serves clients which need to access ccp4i database. Currently DB hanlder supports ccp4i database.def file and SQLite database.
DB handler includes modules dbccp4i.py, manager.py, DBcommand.py, ccp4i.py, dbapi_sqlite.py, schema.sql. These files are located in CVS Bioxhit_db/dbccp4i/dbccp4i repository.
First, you need to set environment variables.
To do this, source ccp4.setup in the ccp4 installation. e.g. source /home/wy45/ccp4-6.0.2/include/ccp4.setup
To do this, source Bioxhit_db.setup in $BIOXHIT_TOP/dbccp4i/bin. e.g source /home/wy45/Bioxhit_db/dbccp4i/bin/Bioxhit_db.setup
There is a command line script 'dbccp4i' in $BIOXHIT_TOP/dbccp4i/bin directory:
Alternatively, go to the directory $BIOXHIT_TOP/dbccp4i/dbccp4i, type:
python dbccp4i.py
Once the DB handler is running, it is waiting for clients to connect to it. If there is no any client to connect it, it will stop automatically after 30 seconds.
This section lists all the requests which are accepted by db handler. A request consists of command and arguments. As mentioned above, requests are sent to the handler in the form of XML, but the requests listed here are without the XML, in the form:
command arg1 arg2...
Response | Description | |
status | result | |
OK | True or 'data locked, force to override, data loaded' | If everything ok, handler return True. If there is a lock in directories.def, handler will override the lock and send back message. |
ERROR | error message | If something goes wrong, handler sends back error messages. |
DbRequestStatus | ||
Summary: Get the status of the handler | ||
Arguments | None |
Response | Description | |
status | result | |
OK | Active | This should return 'Active'. |
ERROR | error message | If something goes wrong, handler sends back error messages. |
DbSupported dbtype | ||
Summary: Get the status of the handler | ||
Arguments | dbtype | database backend, e.g def, SQLite |
Response | Description | |
status | result | |
OK | True | If the handler supports the specified database, it should return True. |
ERROR | False or error message | If the handler doesn't support the specified database, it return 'False'. Or if anything goes wrong, handler returns error message. |
DbDisconnect | ||
Summary: Disconnect to the handler. Handler doesn't send any response to client for this request. | ||
Arguments | None |
ShutDown | ||
Summary: Shutdown the handler. Handler doesn't send any response to client for this request. | ||
Arguments | None |
NewDb project dir | ||
Summary: Create a new project in def backend. | ||
Arguments | project | the name of the project |
dir | directory of the project |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
DbNewRecord project | ||
Summary: Create a job in database. | ||
Arguments | project | the name of the project |
Response | Description | |
status | result | |
OK | Job id | Handler returns job id if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
DbDeleteRecord project jobid | ||
Summary: Delete a job in database. | ||
Arguments | project | the name of the project | jobid | the id of the job to be deleted. |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
Response | Description | |
status | result | |
OK | value(s) of the specified item(s) | Handler returns value(s) if this operation is successful. If retrieve mutiple items, a list of values is returned. |
ERROR | error message | If this operation fails, handler sends back error messages. |
Updatetime project jobid | ||
Summary: Update the time of a job. | ||
Arguments | project | the name of the project | jobid | the id of the job. |
Response | Description | |
status | result | |
OK | True | Handler return True if this operation is successful. |
ERROR | False or error message | If this operation fails, handler sends back 'False' or error messages. |
DbItemExists project jobid item | ||
Summary: Check that item exists for a job. | ||
Arguments | project | the name of the project | jobid | the id of the job. | item | the item name of the job. |
Response | Description | |
status | result | |
OK | True | Handler return True if this operation is successful. |
ERROR | False or error message | If this operation fails, handler sends back 'False' or error messages. |
Response | Description | |
status | result | |
OK | a list of job ids. | Handler return a list of job ids where the values of the given item match the supplied regular expression. |
ERROR | error message | If this operation fails, handler sends back error messages. |
ListJobs project | ||
Summary: List all the job ids of a project. | ||
Arguments | project | the name of the project. |
Response | Description | |
status | result | |
OK | a list of job ids. | Handler returns a list of job ids if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
Response | Description | |
status | result | |
OK | a list of formatted string populated with job data. | Handler returns a list of formatted string populated with job data. |
ERROR | error message | If this operation fails, handler sends back error messages. |
ListProjects | ||
Summary: List all the project names which are recorded in directories.def. | ||
Arguments | None |
Response | Description | |
status | result | |
OK | a list of project names. | Handler returns a list of project names. |
ERROR | error message | If this operation fails, handler sends back error messages. |
GetNProject | ||
Summary: Get the total number of projects. | ||
Arguments | None |
Response | Description | |
status | result | |
OK | the total number of projects | Handler returns the total number of projects. |
ERROR | error message | If this operation fails, handler sends back error messages. |
ImportProject alias path | ||
Summary: Add a reference of a project (alias and path) in the directories.def file. | ||
Arguments | ||
alias | The alias of the project. | |
path | The directory of the project. |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | False or error message | If this operation fails, handler returns False or error messages. |
DeleteProject project | ||
Summary: Delete the reference of a project in directories.def. | ||
Arguments | ||
project | The name of the project. |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | False or error message | If this operation fails, handler returns False or error messages. |
GetProjectDir project | ||
Summary: Get the directory name of the project. | ||
Arguments | ||
project | The name of the project. |
Response | Description | |
status | result | |
OK | The directory name | Handler returns the directory name if this operation is successful. |
ERROR | Empty string or error message | If this operation fails, handler returns empty string or error messages. |
ListDefDirs | ||
Summary: Return a list of the user's default directories. | ||
Arguments | ||
None |
Response | Description | |
status | result | |
OK | a list of the user's default directories | Handler returns a list of the user's default directories if this operation is successful. |
ERROR | error message | If this operation fails, handler returns error messages. |
GetDefDir def_dir | ||
Summary: Return the directory corresponding to a def dir name. | ||
Arguments | ||
def_dir | default directory name. |
Response | Description | |
status | result | |
OK | directory | Handler returns directory name if this operation is successful. |
ERROR | error message | If this operation fails, handler returns error messages. |
GetNJOB project | ||
Summary: Return the last number of job in project. | ||
Arguments | ||
project | The name of the project. |
Response | Description | |
status | result | |
OK | The last number of the job. | Handler returns the last number of the job if this operation is successful. |
ERROR | error message | If this operation fails, handler returns error messages. |
GetNextJobList project jobid | ||
Summary: Return a list of job ids which are related to the given job. | ||
Arguments | ||
project | The name of the project. | |
jobid | The id of the job. |
Response | Description | |
status | result | |
OK | a list of job ids | Handler returns a list of job ids which are related to the given job if this operation is successful. |
ERROR | error message | If this operation fails, handler returns error messages. |
GetAllLinks project | ||
Summary: Returns a list of job pairs. Each pair of jobs indicates these two jobs are related to each other. | ||
Arguments | ||
project | The name of the project. |
Response | Description | |
status | result | |
OK | a list of job pairs | Handler returns a list of job pairs if this operation is successful. |
ERROR | error message | If this operation fails, handler returns error messages. |
Response | Description | |
status | result | |
OK | a list of job pairs | Handler returns a list of job pairs if this operation is successful. |
ERROR | error message | If this operation fails, handler returns error messages. |
DbGetListofRecords project joblist itemlist | ||
Summary: Get a list of jobs' item value. | ||
Arguments | ||
project | The name of the project. | |
joblist | A list of job ids. | |
itemlist | A list of item names. |
Response | Description | |
status | result | |
OK | a list of jobs' item value. | Handler returns a list of jobs' item value if this operation is successful. |
ERROR | error message | If this operation fails, handler returns error messages. |
GetAllChildren project jobid | ||
Summary: For a particular project, given a job id, get all the jobs which are children(all level) of this job. | ||
Arguments | ||
project | The name of the project. | |
jobid | job id |
Response | Description | |
status | result | |
OK | a list of job ids. | Handler returns a list of job ids if this operation is successful. |
ERROR | error message | If this operation fails, handler returns error messages. |
GetAllParents project jobid | ||
Summary: For a particular project, given a job id, get all the jobs which are parent (all level) of this job. | ||
Arguments | ||
project | The name of the project. | |
jobid | job id |
Response | Description | |
status | result | |
OK | a list of job ids. | Handler returns a list of job ids if this operation is successful. |
ERROR | error message | If this operation fails, handler returns error messages. |
DbClose project | ||
Summary: Close a project. | ||
Arguments | project | the name of the project |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
NewDB_sql dbname dir | ||
Summary: Create a new database in SQLite. | ||
Arguments | dbname | the name of the database | dir | the directory of the database |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
OpenDB_sql dbname dir | ||
Summary: Open an existing database in SQLite. | ||
Arguments | dbname | the name of the database | dir | the directory of the database |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
GetJobData_sql jobid item [ item2 ...] | ||
Summary: Return the value(s) of one or more items in a job. | ||
Arguments | jobid | the id of job. | item | item name of the job. Could specify one or more item names. |
Response | Description | |
status | result | |
OK | a list of item value(s) | Handler returns a list of item value(s) if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
GetProjectId projectname | ||
Summary: Given a project name, return project id. | ||
Arguments | projectname | the name of the project. |
Response | Description | |
status | result | |
OK | project id | Handler returns project id if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
Response | Description | |
status | result | |
OK | a list of value(s) | Handler returns a list of value(s) if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
GetProjectList | ||
Summary: Return a list of projects in the database. | ||
Arguments | None |
Response | Description | |
status | result | |
OK | a list of project names. | Handler returns a list of project names if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
GetJobList project | ||
Summary: Return a list of job records for a given proejct. | ||
Arguments | project | the name of project. |
Response | Description | |
status | result | |
OK | a list of job records. | Handler returns a list of jobrecords if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
GetRowofTable table | ||
Summary: Return a row of a table.. | ||
Arguments | id | the id of record. |
Response | Description | |
status | result | |
OK | record | Handler returns a record of a table if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
NewProject_sql projectname | ||
Summary: Create a new project. | ||
Arguments | projectname | the project name |
Response | Description | |
status | result | |
OK | project id | Handler returns a project id if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
NewJob_sql projectname | ||
Summary: Create a new job in a project. | ||
Arguments | projectname | the project name |
Response | Description | |
status | result | |
OK | job id | Handler returns a job id if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
NewRecord table | ||
Summary: Create a new record in table. | ||
Arguments | table | the table name |
Response | Description | |
status | result | |
OK | record id | Handler returns a record id if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
CloseDB_sql | ||
Summary: Close database in SQLite. | ||
Arguments | None |
Response | Description | |
status | result | |
OK | True | Handler returns True if this operation is successful. |
ERROR | error message | If this operation fails, handler sends back error messages. |
Last commit: $Date: 2007/01/25 11:44:48 $