1<html>
2<head>
3	<title>Registrar Notes</title>
4</head>
5<body bgcolor='#ffffff'>
6<font face='Tahoma,Arial,SansSerif'>
7
8<!-- Tasks -->
9<hr>
10<b>Registrar Tasks:</b>
11<ul>
12	<li> MIME Database chores (note that BMimeType appears to read from the database directly for <code>Get*()</code> calls.)<br>
13		<ul>
14			<li> Writes to the database -- <code>SetLongDescription(), SetPreferredApp(), create_app_meta_mime(), etc</code> 
15			<li> Monitoring of the database -- <code>{Start,Stop}Watching()</code> <br>
16			<li> Sniffer duties -- Sniffer code plus <code>{Get,Set,Check}SnifferRule()</code>
17		</ul>
18		<br>
19		
20	<li> Timing chores
21		<ul>
22			<li> BMessageRunner functionality
23		</ul>
24	<li> System Shutdown chores <br>
25		<ul>
26			<li> Shutdown cycle 
27			<li> System shutdown window
28		</ul>
29	<li> Roster chores
30		<ul>
31			<li> Recent documents, folders, and apps
32			<li> Info about running applications
33			<li> etc...
34		</ul>		
35</ul>
36
37<!-- Internals -->
38<hr>
39<b>Registrar Internals:</b><br>
40<br>
41
42The registrar is a non-standard <code>BApplication</code>. It has a shadow app in the <code>app_server</code>
43like a normal <code>BApplication</code>, but one of its ports is slightly different:
44
45<ul>
46	<li> Standard ports -- snd, rcv, AppLooperPort
47	<li> Registrar ports -- snd, rcv, _roster_port_
48</ul>
49 
50Since <code>BLooper::port_id</code> is private to <code>BLooper</code> (to whom <code>BApplication</code>
51is a friend), and since you can't rename a port after it's been created,
52it's likely that the only way to rename the <code>AppLooperPort</code> and have the registrar
53still be a <code>BApplication</code> is to have <code>BApplication</code> check if it's the
54registrar when it's created, and use <code>_roster_port_</code> as the name for what would
55otherwise be its <code>AppLooperPort</code>.
56<br>
57<br>
58The rationale behind having a port with a specific name is that the registrar
59implements the roster functionality. Thus one can't address it using the app signature
60constructor of BMessenger, but rather must send the message directly to
61a named port (for example, upon creation, a BApplication object must find and contact
62the registrar to notify it of another running application; if the registrar
63cannot be found, the application putzes out). 
64
65<br>
66<br>
67
68The Registrar has three threads:
69<ul>
70	<li> _roster_thread_
71	<li> timer_thread
72	<li> main_mime
73</ul>
74 
75<!-- BMimeType Notes -->
76<hr>
77<b>BMimeType Notes:</b>
78<ul>
79	<li> The <code>Get*()</code> methods directly access the MIME database.
80	<li> The <code>Set*()</code> methods send a message to another entity which does the job.
81		The function that does the sending is called <code>_send_to_roster_()</code>, so I
82		suppose the roster is the one. Since the registrar has a thread named
83		<code>_roster_thread_</code>, I assume the roster lives in the registrar.
84	<li> <code>Start/StopWatching()</code> call <code>BRoster::_Start/_StopWatching()</code>.
85	<li>Adding/removing a MIME type file in <code>~/config/settings/beos_mime/*/</code> does
86		not trigger a notification message. So obviously no node monitoring is
87		done and changes to the database are supposed to be done using the API.
88</ul>
89<!-- Links -->
90<hr>
91<b>Links:</b>
92<ul>
93	<li> <a href='http://testou.free.fr/www.beatjapan.org/mirror/www.be.com/users/iconworld/icon5.html'>Icon World -- The Registrar</a>
94	<li> <a href='https://birdhouse.org/beos/bible/exc_filetype.html'>The BeOS Bible -- File Typing and The Registrar</a>
95	<li> <a href='https://www.haiku-os.org/legacy-docs/bebook/BApplication.html'>BApplication</a>
96	<li> <a href='https://www.haiku-os.org/legacy-docs/bebook/BMimeType.html'>BMimeType</a>
97	<li> <a href='http://www.tycomsystems.com/beos/BeBook/Release%20Notes/StorageKit.html'>BMimeType (sniffer docs)</a>
98	<li> <a href='https://www.haiku-os.org/legacy-docs/bebook/BRoster.html'>BRoster</a>
99 
100</font>
101</body>
102</html>
103