| 1 |
<HTML> |
| 2 |
|
| 3 |
<HEAD> |
| 4 |
<TITLE>Spec/Design For User Configuration Of Acedb Programs</TITLE> |
| 5 |
|
| 6 |
<LINK rel=stylesheet type="text/css" |
| 7 |
href="../wdoc.css" |
| 8 |
title="Style sheet for wdoc developer documents"> |
| 9 |
|
| 10 |
</HEAD> |
| 11 |
|
| 12 |
<BODY> |
| 13 |
|
| 14 |
<H1>Spec/Design For User Configuration Of Acedb Programs</H1> |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
<H2>General Configuration</H2> |
| 19 |
|
| 20 |
<H3>Design points</H3> |
| 21 |
|
| 22 |
<P>The following are a heavily randomised series of jottings/issues: |
| 23 |
|
| 24 |
<ul> |
| 25 |
<li>We need database specific configuration files because some settings will |
| 26 |
vary widely between databases, e.g. for FMap the columns (i.e. Method objects) |
| 27 |
may be completely different between different databases. |
| 28 |
<li>Configuration files should be simple text based files that follow the usual |
| 29 |
stanza or .ini files type format. |
| 30 |
<li>Need to remember that resources, while mostly set from and applying to xace, |
| 31 |
may also be relevant to tace or the server, this may raise some implementation |
| 32 |
issues, e.g. sometimes stanzas will need to be read and sometimes need to be |
| 33 |
ignored, e.g. there's no point in the server or tace reading the "FMap" stanza. |
| 34 |
<li>should each stanza need to have a complete list of the configuration for that |
| 35 |
stanza ? Probably, otherwise we have to "know" which bits have been changed |
| 36 |
from the hard coded defaults, probably easiest to save everything. Code |
| 37 |
should probably complain about unknown keywords within stanzas. |
| 38 |
</ul> |
| 39 |
|
| 40 |
|
| 41 |
<H3>File and Directory structure</H3> |
| 42 |
|
| 43 |
<P>The current .acedbrc file should be replaced with a .acedbrc <b>directory</b>. |
| 44 |
The version of the code that uses the new directory structure |
| 45 |
should check whether .acedbrc is a |
| 46 |
file and if it is should refuse to run, issuing an error message to say that the |
| 47 |
user needs to run a script to update their defaults.. We should provide a perl script to |
| 48 |
convert .acedbrc files to the equivalent directories. Lets keep the actual acedb |
| 49 |
code as simple as possible. |
| 50 |
<p><strong>NB</strong> The Windows version uses the registry, so will need to be handled differently.</p> |
| 51 |
<P>I would envisage something like the following structure: |
| 52 |
|
| 53 |
<P><pre><code> |
| 54 |
----------- Common_Defaults.conf |
| 55 |
| |
| 56 |
| |
| 57 |
|----------- C_elegans.conf |
| 58 |
.acedbrc ------| |
| 59 |
| |
| 60 |
|----------- lace.conf |
| 61 |
| |
| 62 |
| |
| 63 |
----------- zebra.conf |
| 64 |
|
| 65 |
</code></pre> |
| 66 |
|
| 67 |
<P>There are essentially two sorts of file here, a common set of defaults |
| 68 |
contained in Common_defaults.conf and database specific defaults contained |
| 69 |
in other configuration files. |
| 70 |
|
| 71 |
<P>The file Common_Defaults.conf would hold a set of defaults that would always be |
| 72 |
applied to xace when it starts up, but if the database was one that equated to |
| 73 |
"lace" for example, then defaults from lace.conf would override the common defaults. |
| 74 |
|
| 75 |
<P>(Note that our perl script to migrate users existing .acedbrc file to the .acedbrc |
| 76 |
directory would put the existing defaults into Common_Defaults.conf.) |
| 77 |
|
| 78 |
<P>It would probably be simplest to derive the names for the database specific defaults files |
| 79 |
directly from the database itself. The most obvious text in the database to use |
| 80 |
would be that given by the "NAME" keyword in wspec/database.wrm, this is much more |
| 81 |
constant than that given by the "TITLE" keyword. In general users tend to keep "NAME" |
| 82 |
constant while changing "TITLE" with each new release of their database. Here are the |
| 83 |
descriptions: |
| 84 |
|
| 85 |
<P><pre><code> |
| 86 |
// NAME is database name, this is set in the database super block when the database |
| 87 |
// is rebuilt. It can only be changed by rebuilding the database and can be used |
| 88 |
// as a reliable identifier for the database. This name is used in the main window |
| 89 |
// header and in status output. |
| 90 |
// |
| 91 |
// TITLE is an additional database name that is reread each time the database is |
| 92 |
// restarted. It can be used to give a more temporary title to a database to give |
| 93 |
// more information about the database. This title is used in the main window |
| 94 |
// and will override the main window title in wspec/displays.wrm, its also used in |
| 95 |
// the status output. |
| 96 |
</code></pre> |
| 97 |
|
| 98 |
<P>One can imagine a really fancy system of configuration files that used both of the |
| 99 |
above but this seems overkill. |
| 100 |
|
| 101 |
<P>One point I haven't thought through: should we allow a configuration file to |
| 102 |
be stored in the wspec directory of the database itself ? This would allow the |
| 103 |
database administrator to supply some useful defaults with their database and save |
| 104 |
the user the trouble of setting up their own. I think this would be a worthwhile |
| 105 |
addition. Note that in the sequence of reading defaults, the users own configuration |
| 106 |
file for a particular database should take preference over the one stored in the |
| 107 |
database. This all works if we have a strict order of reading defaults along |
| 108 |
the lines of: |
| 109 |
|
| 110 |
<P><pre><code> |
| 111 |
defaults set in the code |
| 112 |
| |
| 113 |
V |
| 114 |
.acedbrc/Common_defaults.conf |
| 115 |
| |
| 116 |
V |
| 117 |
defaults in <user_database>/wspec/database.conf |
| 118 |
| |
| 119 |
V |
| 120 |
.acedbrc/<user_database_NAME>.conf |
| 121 |
|
| 122 |
</code></pre> |
| 123 |
|
| 124 |
<P>This design of having multiple "layers" of defaults with each successive one |
| 125 |
overriding or augmenting the defaults of the previous one is a tried and trusted |
| 126 |
way of doing things in the XWindows/Xt world and one I think its worth us copying. |
| 127 |
|
| 128 |
|
| 129 |
<H3>File format</H3> |
| 130 |
|
| 131 |
<P>Should be a stanza per resource section of acedb, sections will probably |
| 132 |
be something like "Tree Display", "FMap display" etc. The precise format would |
| 133 |
probably be pretty much like that used in many unix utilities, here is an example |
| 134 |
from xinetd (the file is /etc/xinetd.d/chargen): |
| 135 |
|
| 136 |
<pre><code> |
| 137 |
# default: off |
| 138 |
# description: An xinetd internal service which generate characters. \ |
| 139 |
# The xinetd internal service which continuously generates characters \ |
| 140 |
# until the connection is dropped. The characters look something like this: \ |
| 141 |
# !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg \ |
| 142 |
# This is the tcp version. |
| 143 |
|
| 144 |
service chargen |
| 145 |
{ |
| 146 |
type = INTERNAL |
| 147 |
id = chargen-stream |
| 148 |
socket_type = stream |
| 149 |
protocol = tcp |
| 150 |
user = root |
| 151 |
wait = no |
| 152 |
disable = yes |
| 153 |
} |
| 154 |
</code></pre> |
| 155 |
|
| 156 |
<P>Worth noting are the "#" for comments, acedb uses "//" so perhaps we should |
| 157 |
continue with that, whichever we do we must allow comments. Also note the |
| 158 |
stanza format with a stanza type, "service" and a stanza name, "chargen". |
| 159 |
Inside the stanza everything is a "keyword = value" pair. |
| 160 |
|
| 161 |
<P>We probably wouldn't have many stanza "type"s, but its probably worth |
| 162 |
having a "type" and a "name" as it allows greater flexibility and it may make it |
| 163 |
easier to parse for instance only non-"graphic" stanzas and so on. |
| 164 |
|
| 165 |
<P>An abbreviated (and fictious) example file for acedb might contain: |
| 166 |
|
| 167 |
<pre><code> |
| 168 |
// File generated by Acedb 4_9q xace on <timestamp> |
| 169 |
// File last updated by Acedb 4_9s tace on <timestamp> |
| 170 |
// |
| 171 |
// Warning: this file is automatically generated and maintained by Acedb code, |
| 172 |
// do not hand edit. |
| 173 |
// |
| 174 |
|
| 175 |
all startup |
| 176 |
{ |
| 177 |
banner = no |
| 178 |
splash_screen = no |
| 179 |
} |
| 180 |
|
| 181 |
graphic Key |
| 182 |
{ |
| 183 |
auto_display_of_single_key = no // I've wanted to add this for ages ! |
| 184 |
} |
| 185 |
|
| 186 |
graphic FMap |
| 187 |
{ |
| 188 |
columns = RNAi genefinder ....long list of column names |
| 189 |
initial_zoom = 0.5 |
| 190 |
} |
| 191 |
</code></pre> |
| 192 |
|
| 193 |
<P>We should allow tabs and spaces interchangeably. |
| 194 |
|
| 195 |
|
| 196 |
<H3>How it would work</H3> |
| 197 |
|
| 198 |
<P>Should stanza reading be lazy or not ? That is, should we try to read all the |
| 199 |
stanzas at program startup or as they are needed ? I'm not sure, in some ways lazy |
| 200 |
evaluation would be simpler perhaps because there won't be issues about having to store |
| 201 |
stanzas in memory until they are needed etc. etc. One to think about. |
| 202 |
|
| 203 |
<P>To start off I think we should allow resource setting only from xace, we shouldn't |
| 204 |
worry about providing a command line interface for tace/giface/server. (but note that |
| 205 |
the command line programs will be reading the config files). People can always |
| 206 |
hand edit the files for now, with guidance ! |
| 207 |
|
| 208 |
<P>Hence the following is all talking about xace. |
| 209 |
|
| 210 |
<P>It's very likely that a user would want to be able to set resources both from |
| 211 |
the main window and from individual windows, e.g. I may want to set FMap configuration |
| 212 |
without having an FMap actually on the screen. This implies that we need some functions |
| 213 |
that can be called both from some code attached to the main window and from individual |
| 214 |
windows. |
| 215 |
|
| 216 |
<P>The main window would need a new "Set Configuration" menu item which when selected |
| 217 |
would popup a submenu containing all the sections (i.e. stanzas) that could be set, |
| 218 |
the user would then select one and a GTK "notebook" would appear which allows editting |
| 219 |
of those resources. |
| 220 |
|
| 221 |
<P>Each individual window would need a new "Set Configuration" button of menu item that |
| 222 |
when selected would display the same GTK "notebook" as would appear from the main window. |
| 223 |
|
| 224 |
<P>The notebook section would need to provide the following buttons at least: |
| 225 |
<ul> |
| 226 |
<li>"Cancel" - throw away all <b>unsaved</b> changes, i.e. return to the configuration as it was |
| 227 |
before the user changed any configuration and quit the notebook. |
| 228 |
<li>"Apply" - apply configuration to program but don't save |
| 229 |
<li>"Save" - save the configuration to the appropriate stanza file (NOTE that user |
| 230 |
should be offered the choice of saving to Common_defaults.conf or the database |
| 231 |
specific configuration file <b>IF</b> the latter exist, we shouldn't force users |
| 232 |
to have database specific configuration files). |
| 233 |
<li>"Quit" - quit the notebook but leave in place any changes that have been made |
| 234 |
whether they have been saved or not, should warn the user that changes have not |
| 235 |
been saved yet. |
| 236 |
</ul> |
| 237 |
|
| 238 |
|
| 239 |
<P>Each section of acedb (e.g. FMap) needs to provide at least two routines |
| 240 |
(and probably some more !). |
| 241 |
|
| 242 |
<P>The first will be "internal" to that section of acedb |
| 243 |
and will be responsible for reading and applying the defaults when that section of |
| 244 |
acedb is called, e.g. when an FMap is displayed the Fmap stanza will need to be read. But |
| 245 |
note that if the user has already configured fmap, there may be a configuration in memory |
| 246 |
(see below). |
| 247 |
|
| 248 |
<P>The second will be "external" in that it will be callable both from the section itself |
| 249 |
and from the main window, it will need to do the following: |
| 250 |
|
| 251 |
<ul> |
| 252 |
<li>read its particular stanza from the stanza file(s) |
| 253 |
<li>create a GTK notebook from the settings in the stanza and by doing whatever |
| 254 |
querying is required of the database etc, e.g. for FMap it would need to query |
| 255 |
the names of all Method objects as these are in essence the available columns |
| 256 |
for the FMap display. |
| 257 |
<li>provide callback routines that will be called as the user interacts with the |
| 258 |
notebook, this may need to do things like "Recalculate" the FMap when the user |
| 259 |
clicks the "Apply" button for the FMap resources. |
| 260 |
<li>The function would need to make sure that the configuration is held in memory |
| 261 |
somewhere so it can be retrieved later, e.g. a user may configure fmap without |
| 262 |
an fmap on the screen, then when the fmap starts up it needs access to the configuration |
| 263 |
which may only be in memory because the user has not saved it. |
| 264 |
</ul> |
| 265 |
|
| 266 |
<P>When xace starts up it should call a function that sets up a table of callback functions |
| 267 |
for each stanza, this doesn't need to be terribly dynamic/sophisticated it can just be a |
| 268 |
hard coded table of "stanza_name : callback_function" pairs. This would be used by the main |
| 269 |
window code to call the appropriate function for editting each configuration stanza. |
| 270 |
|
| 271 |
|
| 272 |
<h3>Rob's Notes</h3> |
| 273 |
<p>The GTK Notebook widget gives you pages with tabs in typical Windoze style. For many of the |
| 274 |
bits of xace which might need configuration I imagine a single page would be sufficient, |
| 275 |
but for fmap, frinstance, we might want several pages. This means a generic configuration |
| 276 |
function would be harder to implement, so we might want one for each part of the display. |
| 277 |
|
| 278 |
Hence the list connecting the area of the display with the function. Each function |
| 279 |
should then be callable from the individual area of the display to which it applies |
| 280 |
or from the main xace window.</p> |
| 281 |
|
| 282 |
<p>For fmap columns we might want a scrollable window of check boxes, one for each method. So (don't |
| 283 |
know how practical this is) get all methods from db and populate the window on the cols page. |
| 284 |
|
| 285 |
The other bit, also covered above, is about a globally available config struct, held in |
| 286 |
memory, so if the user does some local configuration but doesn't save it, each time she revisits |
| 287 |
that area of the display, the configuration in memory is the one that's applied. Once she |
| 288 |
exits and restarts, she'll get whatever's on disk, of course. |
| 289 |
|
| 290 |
|
| 291 |
<H2>Specific FMap issues</H2> |
| 292 |
|
| 293 |
<H3>READ THIS FIRST !</H3> |
| 294 |
|
| 295 |
<b><P>ROB, all of the following was from earlier thoughts about fmap specifically. Some of it |
| 296 |
clashes with the stuff above. I think the below is probably all too complex, I'm |
| 297 |
not sure users would really want lots of views per database. I think its likely they would |
| 298 |
prefer to have just one view per database which remove much complexity from below. I also |
| 299 |
think that storing fmap configuration in the database is a mistake because it would not then |
| 300 |
be per user (or not easily at least) ! |
| 301 |
|
| 302 |
<P>I think we should take the good bits from below, e.g. the idea of setting up your fmap |
| 303 |
as you like it (size, columns etc) and then clicking a single "Save configuration" button |
| 304 |
would be a good addition to the way configuration could be done. Anything that no longer |
| 305 |
seems relevant we should junk. |
| 306 |
I have not tried to merge this section with the above, it would take too long and isn't worth |
| 307 |
it, we can talk through anything you are not sure of ! |
| 308 |
</b> |
| 309 |
|
| 310 |
<H3>Requirements</H3> |
| 311 |
|
| 312 |
<p>The term "<CODE>View</CODE>" means a particular arrangement of fmap: |
| 313 |
the window size, which columns are on/off, how the columns are configured and |
| 314 |
so on. The <CODE>View</CODE> will be stored in a file so that subsequently it can be |
| 315 |
loaded into the fmap to produce an individually customised "look and feel". |
| 316 |
|
| 317 |
<p>Requirements for such <CODE>Views</CODE> include: |
| 318 |
|
| 319 |
<dl> |
| 320 |
<dt><b>user specific -</b> |
| 321 |
<dd>Each user needs to have their own set of defaults. |
| 322 |
<dt><b>database specific -</b> |
| 323 |
<dd>should be able to have a specific <CODE>View</CODE> for a database |
| 324 |
<dt><b>interchangeable <CODE>Views</CODE> -</b> |
| 325 |
<dd>the user should be able to switch between <CODE>Views</CODE> while in fmap |
| 326 |
<dt><b>easy set up -</b> |
| 327 |
<dd>it should be simple for the user to create a <CODE>Views</CODE> by arranging |
| 328 |
an fmap in the way they would like and then saving that arrangement as a <CODE>View</CODE> |
| 329 |
<dt><b>editting of <CODE>Views</CODE> -</b> |
| 330 |
<dd>editting of a <CODE>View</CODE> should be as simple as displaying an fmap using |
| 331 |
the <CODE>View</CODE> to be editted, changing the <CODE>View</CODE> and then saving it. Its |
| 332 |
also important the the <CODE>View</CODE> should be saved as plain text to |
| 333 |
allow experienced users to "hand-edit" the file. |
| 334 |
<dt><b>location of <CODE>Views</CODE> -</b> |
| 335 |
<dd>by default the <CODE>Views</CODE> will be stored in the users home directory, |
| 336 |
but it should be possible to specify an alternative to this. |
| 337 |
</dl> |
| 338 |
|
| 339 |
|
| 340 |
<H3>Spec.</H3> |
| 341 |
|
| 342 |
<p>This is an initial design based on the preceding requirements. |
| 343 |
|
| 344 |
|
| 345 |
<H4>What should the <CODE>View</CODE> hold ?</H4> |
| 346 |
|
| 347 |
<dl> |
| 348 |
<dt><b>fmap window size -</b> |
| 349 |
<dd>this can only be customised per database at the moment, |
| 350 |
the <CODE>View</CODE> will allow the user to specify a default size and position |
| 351 |
of their own. |
| 352 |
<dt><b>global flags -</b> |
| 353 |
<dd>these are flags that apply to the whole of fmap, such |
| 354 |
as "Preserve". |
| 355 |
<dt><b>column on/off -</b> |
| 356 |
<dd>the on/off state of all columns will be stored. |
| 357 |
<dt><b>column config -</b> |
| 358 |
<dd>will include "bumpable" setting etc. |
| 359 |
</dl> |
| 360 |
|
| 361 |
<H4>How will <CODE>Views</CODE> be stored ?</H4> |
| 362 |
|
| 363 |
<P><CODE>Views</CODE> will be held in a subdirectory of the users home |
| 364 |
directory called <b><code>.acedbrc</code></b>, this naming style is a |
| 365 |
de-facto standard on Unix. This is also where current acedb user defaults |
| 366 |
are held. (<b>NOTE</b> that <b><code>.acedbrc</code></b> is currently a file |
| 367 |
so acedb code will have to be rewritten to recreate it as a directory and move the |
| 368 |
existing <b><code>.acedbrc</code></b> into the directory.) |
| 369 |
|
| 370 |
<P>The user will be able to have as many different views as they want, |
| 371 |
each <CODE>View</CODE> will stored in its own subdirectory (probably a subdirectory, but maybe |
| 372 |
just a file) of the <b><code>.acedbrc</code></b> subdirectory. Each <CODE>View</CODE> will be identified |
| 373 |
by a unique name which will also be the name of the subdirectory so |
| 374 |
<CODE>View</CODE> names will be limited to valid characters for filenames. |
| 375 |
<CODE>View</CODE> names will be of the form <b><code>XXXXX.fmapview</code></b>. |
| 376 |
|
| 377 |
<P>An alternative <CODE>View</CODE> directory can be specified either via an environment |
| 378 |
variable or via a command line option to the acedb program. |
| 379 |
|
| 380 |
|
| 381 |
<H4>How will <CODE>Views</CODE> be manipulated by the user ?</H4> |
| 382 |
|
| 383 |
<P>The user will create new views by running xace on a database, |
| 384 |
displaying the fmap, configuring the fmap and then using a new "Save View" |
| 385 |
menu item to save the <CODE>View</CODE>. |
| 386 |
|
| 387 |
<P>A particular <CODE>View</CODE> will be selected using a variant of the "File Chooser" |
| 388 |
window to select the required <CODE>View</CODE>. |
| 389 |
|
| 390 |
<P>Existing <CODE>Views</CODE> will be altered by selecting the <CODE>View</CODE> |
| 391 |
from fmap, reconfiguring and resaving the <CODE>View</CODE>. |
| 392 |
|
| 393 |
<P>The user will be able to make one particular <CODE>View</CODE> their |
| 394 |
default <CODE>View</CODE> which will be used unless overidden in the way specified |
| 395 |
below, this view will be called <code><b>DEFAULT.fmapview</b></code>. |
| 396 |
|
| 397 |
<P>The user will be able to associate a <CODE>View</CODE> with a database when saving |
| 398 |
the <CODE>View</CODE>. The <CODE>View</CODE> will be given the |
| 399 |
name of the database as given by the "-t" field for _DDtMain in wspec/displays.wrm. |
| 400 |
This still leaves the NAME option in wspec/database.wrm as a |
| 401 |
changeable field for the curator to indicate different versions of a |
| 402 |
database without invaliding the <CODE>View</CODE> to database mapping. |
| 403 |
|
| 404 |
<P>Which <CODE>View</CODE> will be used by xace will be decided in this |
| 405 |
order: |
| 406 |
<ol> |
| 407 |
<li>The default <CODE>View</CODE> |
| 408 |
<li>the database specific <CODE>View</CODE> |
| 409 |
<li>a <CODE>View</CODE> specified by the $ACEDB_FMAP_VIEW environment variable |
| 410 |
<li>a <CODE>View</CODE> specified on the command line via the -fmapview flag |
| 411 |
</ol> |
| 412 |
|
| 413 |
<P>No blending of <CODE>Views</CODE> will be done, the code will simply |
| 414 |
use the last name from the above list to identify which <CODE>View</CODE to load. |
| 415 |
Note that the <CODE>View</CODE> finally loaded can subsequently be replaced |
| 416 |
by an alternative from within fmap. |
| 417 |
|
| 418 |
|
| 419 |
<H4>What format will <CODE>Views</CODE> be save in ?</H4> |
| 420 |
|
| 421 |
<P>Since much of the column configuration data is already held in the form |
| 422 |
of "<code>Method</code>" objects, <CODE>Views</CODE> will make use of this |
| 423 |
and be stored as ace files. This will require an addition to the models |
| 424 |
held by a database to include some kind of "fmap" model. This needs further |
| 425 |
discussion, on the face there is no reason not to have an fmap model, we already |
| 426 |
have method objects in the database, so why not an fmap object. |
| 427 |
|
| 428 |
<P>Storing the <CODE>Views</CODE> as fmaps will allow experienced users to |
| 429 |
hand-edit their <CODE>Views</CODE>. It also means that the existing acedb |
| 430 |
parse code can very simply be used to read in a <CODE>View</CODE>. |
| 431 |
|
| 432 |
|
| 433 |
<HR> |
| 434 |
<ADDRESS><a href="mailto:[email protected]">Ed Griffiths <[email protected]></a></ADDRESS> |
| 435 |
<!-- hhmts start --> |
| 436 |
Last modified: Fri Jun 13 16:45:43 BST 2003 |
| 437 |
<!-- hhmts end --> |
| 438 |
</BODY> |
| 439 |
</HTML> |