ch01.sgm 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. <!-- $XConsortium: ch01.sgm /main/8 1996/09/08 19:35:32 rws $ -->
  2. <!-- (c) Copyright 1995 Digital Equipment Corporation. -->
  3. <!-- (c) Copyright 1995 Hewlett-Packard Company. -->
  4. <!-- (c) Copyright 1995 International Business Machines Corp. -->
  5. <!-- (c) Copyright 1995 Sun Microsystems, Inc. -->
  6. <!-- (c) Copyright 1995 Novell, Inc. -->
  7. <!-- (c) Copyright 1995 FUJITSU LIMITED. -->
  8. <!-- (c) Copyright 1995 Hitachi. -->
  9. <Chapter Id="TTUG.Intro.div.1">
  10. <Title Id="TTUG.Intro.mkr.1">Introducing the ToolTalk Service</Title>
  11. <Para>As computer users increasingly demand that independently developed
  12. applications work together, inter-operability is becoming an important theme
  13. for software developers. By cooperatively using each other's facilities,
  14. inter&hyphen;operating applications offer users capabilities that would be difficult to
  15. provide in a single application. The ToolTalk service is designed to facilitate the
  16. development of inter-operating applications that serve individuals and work
  17. groups.</Para>
  18. <Para>The<IndexTerm>
  19. <Primary>ToolTalk service</Primary>
  20. </IndexTerm>
  21. ToolTalk service enables independent applications to communicate with
  22. each other without having direct knowledge of each other. Applications create
  23. and send ToolTalk messages to communicate with each other. The ToolTalk
  24. service receives these messages, determines the recipients, and then delivers
  25. the messages to the appropriate applications, as shown in
  26. <!--Original XRef content: 'Figure&numsp;1&hyphen;1'--><XRef Role="CodeOrFigureOrTable" Linkend="TTUG.Intro.mkr.2">.</Para>
  27. <Figure>
  28. <Title Id="TTUG.Intro.mkr.2">Applications Using the ToolTalk Service</Title>
  29. <Graphic Entityref="TTUG.Intro.fig.1" Id="TTUG.Intro.grph.1"></Graphic>
  30. </Figure>
  31. <Sect1 Id="TTUG.Intro.div.2">
  32. <Title>What Kind of Work Problems Can the ToolTalk Service Solve?</Title>
  33. <Para>This section describes some of the<IndexTerm>
  34. <Primary>inter-operability problems, solved by the ToolTalk service</Primary>
  35. </IndexTerm>
  36. inter-operability problems the ToolTalk
  37. service is designed to solve. The ToolTalk service is the appropriate technology
  38. to use if your application needs:</Para>
  39. <ItemizedList Remap="Bullet1">
  40. <ListItem>
  41. <Para>Tool inter&hyphen;changeability</Para>
  42. </ListItem>
  43. <ListItem>
  44. <Para>Control integration</Para>
  45. </ListItem>
  46. <ListItem>
  47. <Para>Network&hyphen;transparent events that are not owned by any well&hyphen;known server
  48. (for example, an X server) and that do not have any predictable set of
  49. listeners</Para>
  50. </ListItem>
  51. <ListItem>
  52. <Para>Automatic tool invocation</Para>
  53. </ListItem>
  54. <ListItem>
  55. <Para>A widely-available distributed object system</Para>
  56. </ListItem>
  57. <ListItem>
  58. <Para>Persistent objects</Para>
  59. </ListItem>
  60. </ItemizedList>
  61. <Para>Of course, there are some inter-operability problems for which the ToolTalk
  62. service may not be the appropriate technology to use. However, when your
  63. application needs to solve both sorts of problems (that is, a combination of
  64. those inter-operability problems for which the ToolTalk service is designed to
  65. solve and those problems for which it is not designed), you can use the
  66. ToolTalk service in combination with other technologies.</Para>
  67. <Sect2 Id="TTUG.Intro.div.3">
  68. <Title>Tool Inter-changeability</Title>
  69. <Para>Use the ToolTalk service when you want<IndexTerm>
  70. <Primary>plug-and-play</Primary>
  71. </IndexTerm>
  72. plug-and-play capability. The term
  73. <Emphasis>plug-and-play</Emphasis> means that any tool can be replaced by any other tool that follows
  74. the same protocol. That is, any tool that follows a given ToolTalk protocol can
  75. be placed (plugged) into your computing environment and perform (play)
  76. those functions indicated by the protocol. Tools can be mixed and matched,
  77. without modification and without having any specific built-in knowledge of
  78. each other.</Para>
  79. </Sect2>
  80. <Sect2 Id="TTUG.Intro.div.4">
  81. <Title>Control Integration</Title>
  82. <Para>Use the ToolTalk service when your application requires<IndexTerm>
  83. <Primary>control integration</Primary>
  84. </IndexTerm>
  85. control integration.
  86. The term <Emphasis>control integration</Emphasis> indicates a group of tools working together toward
  87. a common end without direct user intervention. The ToolTalk service enables
  88. control integration through its easy and flexible facilities for issuing arbitrary
  89. requests, either to specific tool instances or to anonymous service providers.</Para>
  90. </Sect2>
  91. <Sect2 Id="TTUG.Intro.div.5">
  92. <Title>Network-Transparent Events</Title>
  93. <Para>Use the ToolTalk service when your application needs to generate or receive<IndexTerm>
  94. <Primary>network-transparent events</Primary>
  95. </IndexTerm>
  96. network-transparent events. To be useful, traditional event mechanisms (such
  97. as signals and window-system events) require special circumstances; for
  98. example, you must know a process or window ID. The ToolTalk service allows
  99. events to be expressed naturally: in terms of the file to which the event refers,
  100. or the group of processes on the network to which the event is applicable. The
  101. ToolTalk service delivers events (called <Emphasis>notices</Emphasis>) to any interested process
  102. anywhere on the network. ToolTalk notices are a flexible and easy way to
  103. provide extensibility for your system.</Para>
  104. </Sect2>
  105. <Sect2 Id="TTUG.Intro.div.6">
  106. <Title>Automatic Tool Invocation</Title>
  107. <Para>Use the ToolTalk service when your application needs network-transparent<IndexTerm>
  108. <Primary>automatic invocation</Primary>
  109. </IndexTerm>
  110. automatic invocation. The ToolTalk service lets you describe the messages that,
  111. when sent from any location on the network, should cause your tool to be
  112. invoked. The ToolTalk auto-start facility is easier to use and less host-specific
  113. than the conventional <Filename MoreInfo="RefEntry">inetd</Filename>(1) facility.</Para>
  114. </Sect2>
  115. <Sect2 Id="TTUG.Intro.div.7">
  116. <Title>Distributed-Object System</Title>
  117. <Para>Use ToolTalk when you need to build your application on a<IndexTerm>
  118. <Primary>distributed object system</Primary>
  119. </IndexTerm>
  120. distributed-object
  121. system that is available across a wide variety of platforms. ToolTalk's object
  122. system can be used by any application on all the popular UNIX platforms,
  123. regardless of whether the application</Para>
  124. <ItemizedList Remap="Bullet1">
  125. <ListItem>
  126. <Para>Is single- or multi-threaded</Para>
  127. </ListItem>
  128. <ListItem>
  129. <Para>Has a command-line or graphical user interface</Para>
  130. </ListItem>
  131. <ListItem>
  132. <Para>Uses its own event loop, or that of a window-system toolkit</Para>
  133. </ListItem>
  134. </ItemizedList>
  135. <Note>
  136. <Para>Programs coded to the ToolTalk object-oriented messaging interface are
  137. <Symbol Role="Variable">not</Symbol> portable to<IndexTerm>
  138. <Primary>OMG-compliant systems</Primary>
  139. </IndexTerm>
  140. CORBA&hyphen;compliant systems without source changes.</Para>
  141. </Note>
  142. </Sect2>
  143. <Sect2 Id="TTUG.Intro.div.8">
  144. <Title>Persistent Objects</Title>
  145. <Para>Use the ToolTalk service when your application needs to place<IndexTerm>
  146. <Primary>objects, persistent</Primary>
  147. </IndexTerm>
  148. objects
  149. unobtrusively in the UNIX file system.</Para>
  150. </Sect2>
  151. <Sect2 Id="TTUG.Intro.div.9">
  152. <Title>Scenarios Illustrating How the ToolTalk Service Helps Solve Work Problems</Title>
  153. <Para>The s<IndexTerm>
  154. <Primary>scenarios illustrating the ToolTalk service in use</Primary>
  155. </IndexTerm>
  156. cenarios in this section illustrate how the ToolTalk service helps users
  157. solve their work problems. The message protocols used in these scenarios are
  158. hypothetical.</Para>
  159. <Sect3 Id="TTUG.Intro.div.10">
  160. <Title>Using the ToolTalk Desktop Services Message Set</Title>
  161. <Para>The<IndexTerm>
  162. <Primary>ToolTalk message sets</Primary>
  163. <Secondary>Desktop</Secondary>
  164. </IndexTerm>
  165. ToolTalk<IndexTerm>
  166. <Primary>Desktop Services Message Set</Primary>
  167. </IndexTerm>
  168. Desktop Services Message Set allows an application to integrate
  169. and control other applications without user intervention. This section presents
  170. two scenarios (
  171. <!--Original XRef content: '&xd2;The Smart Desktop'--><XRef Role="SectionTitle" Linkend="TTUG.Intro.mkr.3"> and
  172. <!--Original XRef content: '&xd2;Integrated Toolsets&xd3; on page&numsp;6'--><XRef Role="SecTitleAndPageNum" Linkend="TTUG.Intro.mkr.4">) that
  173. show how the Desktop Services Message Set might be implemented.</Para>
  174. <Sect4 Id="TTUG.Intro.div.11">
  175. <Title Id="TTUG.Intro.mkr.3">The Smart Desktop</Title>
  176. <Note>
  177. <Para>The scenario in this section is intended to illustrate how the ToolTalk
  178. service can be used in an application-level program that interprets user
  179. requests; it is <Symbol Role="Variable">not</Symbol> intended to illustrate how the Common Desktop Environment
  180. product implements the ToolTalk service to interpret user
  181. requests.</Para>
  182. </Note>
  183. <Para>A common user requirement for a graphic user interface (GUI) front-end is the
  184. ability to have data files be aware (or &ldquo;know&rdquo;) of their applications. To do this,
  185. an application-level program is needed to interpret the user's requests.
  186. Examples of application-level programs (known as <Emphasis>smart desktops</Emphasis>) are the
  187. Apple Macintosh&reg; finder, Microsoft Windows&trade; File Manager, and the
  188. Common Desktop Desktop File Manager. The key common requirements for
  189. smart desktops are:</Para>
  190. <OrderedList Remap="List1">
  191. <ListItem>
  192. <Para>Takes a file</Para>
  193. </ListItem>
  194. <ListItem>
  195. <Para>Determines its application</Para>
  196. </ListItem>
  197. <ListItem>
  198. <Para>Invokes the application</Para>
  199. </ListItem>
  200. </OrderedList>
  201. <Para>The ToolTalk Service provides additional flexibility by allowing classes of tools
  202. to edit a specific data type. The following scenario illustrates how the Desktop
  203. Services Message Set might be implemented as a smart desktop transparent to
  204. the end-user.</Para>
  205. <OrderedList>
  206. <ListItem>
  207. <Para>Diane double-clicks on the File Manager icon.</Para>
  208. <ItemizedList Remap="Bullet2">
  209. <ListItem>
  210. <Para>The File Manager opens and displays the files in Diane's current directory.</Para>
  211. </ListItem>
  212. </ItemizedList>
  213. </ListItem>
  214. <ListItem>
  215. <Para>Diane double-clicks on an icon for a data file.</Para>
  216. <OrderedList Remap="List2">
  217. <ListItem>
  218. <Para>The File Manager requests that the file represented by the icon be
  219. displayed. The File Manager encodes the file type in the <Symbol Role="Variable">display</Symbol> message.</Para>
  220. </ListItem>
  221. <ListItem>
  222. <Para>The ToolTalk session manager matches the pattern in the <Symbol Role="Variable">display</Symbol> message
  223. to a registered application (in this case, the Icon Editor), and finds an
  224. instance of the application running on Diane's desktop.</Para>
  225. <Note>
  226. <Para>If the ToolTalk session manager does not find a running instance of the
  227. application, it checks the statically-defined<IndexTerm>
  228. <Primary>process type (ptype)</Primary>
  229. </IndexTerm>
  230. process types (ptypes) and starts
  231. an application that best matches the pattern in the message. If none of the
  232. ptypes matches, the session manager returns failure to the File Manager
  233. application.</Para>
  234. </Note>
  235. </ListItem>
  236. <ListItem>
  237. <Para>The Icon Editor accepts the <Symbol Role="Variable">display</Symbol> message, de&hyphen;iconifies itself, and raises
  238. itself to the top of the display.</Para>
  239. </ListItem>
  240. </OrderedList>
  241. </ListItem>
  242. <ListItem>
  243. <Para>Diane manually edits the file.</Para>
  244. </ListItem>
  245. </OrderedList>
  246. </Sect4>
  247. <Sect4 Id="TTUG.Intro.div.12">
  248. <Title Id="TTUG.Intro.mkr.4">Integrated Toolsets</Title>
  249. <Para>Another significant application for which the Desktop Services Message Set
  250. can be implemented is <Emphasis>integrated toolsets</Emphasis>. These environments can be applied in
  251. vertical applications (such as a CASE developer toolset) or in horizontal
  252. environments (such as compound documents). Common to both of these
  253. applications is the premise that the overall solution is built from specialized
  254. applications designed to perform one particular task well. Examples of
  255. integrated toolset applications are text editors, drawing packages, video or
  256. audio display tools, compiler front&hyphen;ends, and debuggers. The integrated toolset
  257. environment requires applications to interact by calling on each other to
  258. handle user requests. For example, to display video, an editor calls a video
  259. display program; or to check a block of completed code, an editor calls a
  260. compiler.</Para>
  261. <Para>The following scenario shows how the Desktop Services Message Set might be
  262. implemented as an integrated toolset:</Para>
  263. <OrderedList>
  264. <ListItem>
  265. <Para>Bruce is working on a compound document using his favorite editor.</Para>
  266. <Para>He decides to change the some of the source code text.</Para>
  267. </ListItem>
  268. <ListItem>
  269. <Para>Bruce double-clicks on the source code text.</Para>
  270. <OrderedList Remap="List2">
  271. <ListItem>
  272. <Para>The Document Editor first determines the text represents source code
  273. and then determines which file contains the source code.</Para>
  274. </ListItem>
  275. <ListItem>
  276. <Para>The Document Editor sends an <Emphasis>edit</Emphasis> message request, using the file name
  277. as a parameter for the message.</Para>
  278. </ListItem>
  279. <ListItem>
  280. <Para>The ToolTalk session manager matches the pattern in the <Emphasis>edit</Emphasis> message to
  281. a registered application (in this case, the Source Code Editor), and finds
  282. an instance of the application running on Bruce's desktop.</Para>
  283. <Note>
  284. <Para>If the ToolTalk session manager does not find a running instance of the
  285. application, it checks the statically-defined ptypes and starts an application
  286. that best matches the pattern in the message. If none of the ptypes matches, the
  287. session manager returns failure to the Document Editor application.</Para>
  288. </Note>
  289. </ListItem>
  290. <ListItem>
  291. <Para>The Source Code Editor accepts the <Emphasis>edit</Emphasis> message request.</Para>
  292. </ListItem>
  293. <ListItem>
  294. <Para>The Source Code Editor determines that the source code file is under
  295. configuration control, and sends a message to check out the file.</Para>
  296. </ListItem>
  297. <ListItem>
  298. <Para>The Source Code Control application accepts the message and creates a
  299. read-write copy of the requested file. It then passes the name of the file
  300. back to the Source Code Editor.</Para>
  301. </ListItem>
  302. <ListItem>
  303. <Para>The Source Code Editor opens a window that contains the source file.</Para>
  304. </ListItem>
  305. </OrderedList>
  306. </ListItem>
  307. <ListItem>
  308. <Para>Bruce edits the source code text.</Para>
  309. </ListItem>
  310. </OrderedList>
  311. </Sect4>
  312. </Sect3>
  313. <Sect3 Id="TTUG.Intro.div.13">
  314. <Title>Using the ToolTalk Document and Media Exchange Message Set</Title>
  315. <Para>The<IndexTerm>
  316. <Primary>ToolTalk message sets</Primary>
  317. <Secondary>Document and Media Exchange</Secondary>
  318. </IndexTerm>
  319. ToolTalk<IndexTerm>
  320. <Primary>Document and Media Exchange Message Set</Primary>
  321. </IndexTerm>
  322. Document and Media Exchange Message Set is very flexible and
  323. robust. This section illustrates three uses of the ToolTalk Document and Media
  324. Exchange Message Set:</Para>
  325. <ItemizedList Remap="Bullet1">
  326. <ListItem>
  327. <Para>Integrating multimedia into an authoring application</Para>
  328. </ListItem>
  329. <ListItem>
  330. <Para>Adding multimedia extensions to an existing application</Para>
  331. </ListItem>
  332. <ListItem>
  333. <Para>Extending the <Emphasis>cut-and-paste</Emphasis> facility of X with a media-translation facility</Para>
  334. </ListItem>
  335. </ItemizedList>
  336. <Sect4 Id="TTUG.Intro.div.14">
  337. <Title>Integrating Multimedia Functionality</Title>
  338. <Para>Integrating multimedia functionality into an application allows end-users of
  339. the application to embed various media types in their documents.</Para>
  340. <Para>Typically, an icon that represents the media object is embedded in the
  341. document. Upon selection of an embedded object, the ToolTalk service
  342. automatically invokes an appropriate external media application and the object
  343. is played as illustrated in the following scenario.</Para>
  344. <OrderedList Remap="List1">
  345. <ListItem>
  346. <Para>Daniel opens a document that contains multimedia objects.</Para>
  347. </ListItem>
  348. <ListItem>
  349. <Para>The window shows the document with several icons representing various
  350. media types (such as sound, video, and graphics).</Para>
  351. </ListItem>
  352. <ListItem>
  353. <Para>Daniel double-clicks on the sound icon.</Para>
  354. <Para>A sound application (called a <Emphasis>player</Emphasis>) is launched and the embedded
  355. recording is played.</Para>
  356. </ListItem>
  357. <ListItem>
  358. <Para>To edit the recording, Daniel clicks once on the icon to select it and uses the
  359. third mouse button to display an Edit menu.</Para>
  360. <Para>An editing application is launched, and Daniel edits the media object.</Para>
  361. </ListItem>
  362. </OrderedList>
  363. </Sect4>
  364. <Sect4 Id="TTUG.Intro.div.15">
  365. <Title>Adding Multimedia Extensions to Existing Applications</Title>
  366. <Para>The ToolTalk Document and Media Exchange Message Set also allows an
  367. application to use other multimedia applications to extend its features or
  368. capabilities. For example, a Calendar Manager can be extended to use the
  369. Audio Tool to play a sound file as a reminder of an appointment, as illustrated
  370. in the following scenario:</Para>
  371. <OrderedList Remap="List1">
  372. <ListItem>
  373. <Para>Shelby opens her Calendar Manager and sets an appointment.</Para>
  374. </ListItem>
  375. <ListItem>
  376. <Para>Shelby clicks on an Audio Response button, which causes the Audio Tool to
  377. start.</Para>
  378. </ListItem>
  379. <ListItem>
  380. <Para>Shelby records her message; for example, &ldquo;Bring the report.&rdquo;</Para>
  381. </ListItem>
  382. </OrderedList>
  383. <Para>When Shelby's appointment reminder is executed, the Calendar Manager will
  384. start the Audio Tool and play Shelby's recorded reminder.</Para>
  385. </Sect4>
  386. <Sect4 Id="TTUG.Intro.div.16">
  387. <Title>Extending the X Cut-and-Paste Facility</Title>
  388. <Para>The ToolTalk Document and Media Exchange Message Set can support an
  389. extensible, open-ended translation facility. The following scenario illustrates
  390. how an extensible multimedia <Emphasis>cut and paste</Emphasis> facility could work:</Para>
  391. <OrderedList Remap="List1">
  392. <ListItem>
  393. <Para>Maria opens two documents that are different media types.</Para>
  394. </ListItem>
  395. <ListItem>
  396. <Para>Maria selects a portion of Document A and cuts the portion using the
  397. standard <Emphasis>X</Emphasis>-windowing <Emphasis>cut</Emphasis> facility.</Para>
  398. </ListItem>
  399. <ListItem>
  400. <Para>Maria then pastes the cut portion into Document B.</Para>
  401. <OrderedList Remap="List2">
  402. <ListItem>
  403. <Para>Document B negotiates the transfer of the cut data with Document A.</Para>
  404. </ListItem>
  405. <ListItem>
  406. <Para>If Document B does not understand any of the types offered by
  407. Document&numsp;A, it requests that Document&numsp;A sends it a <Emphasis>tagged media type</Emphasis>.
  408. Document B uses the tagged media type to broadcast a ToolTalk message
  409. requesting a translation of the media type to a media type it understands.</Para>
  410. </ListItem>
  411. <ListItem>
  412. <Para>A registered translation utility accepts the request and returns the
  413. translated version of the media type to Document B.</Para>
  414. </ListItem>
  415. <ListItem>
  416. <Para>The paste of the translated data into Document B is performed.</Para>
  417. </ListItem>
  418. </OrderedList>
  419. </ListItem>
  420. </OrderedList>
  421. </Sect4>
  422. </Sect3>
  423. </Sect2>
  424. </Sect1>
  425. <Sect1 Id="TTUG.Intro.div.17">
  426. <Title><IndexTerm>
  427. <Primary>how applications use ToolTalk messages</Primary>
  428. </IndexTerm>How Applications Use ToolTalk Messages</Title>
  429. <Para>Applications create, send, and receive ToolTalk messages to communicate with
  430. other applications<Interface Class="Button">.<IndexTerm>
  431. <Primary>senders</Primary>
  432. </IndexTerm>
  433. Senders</Interface> create, fill in, and send a message; the ToolTalk
  434. service determines the recipients and delivers the message to the<IndexTerm>
  435. <Primary>recipients</Primary>
  436. </IndexTerm>
  437. recipients.
  438. Recipients retrieve messages, examine the information in the message, and
  439. then either discard the message or perform an operation and reply with the
  440. results.</Para>
  441. <Sect2 Id="TTUG.Intro.div.18">
  442. <Title><IndexTerm>
  443. <Primary>sending ToolTalk messages</Primary>
  444. </IndexTerm><IndexTerm>
  445. <Primary>messages</Primary>
  446. <Secondary>sending</Secondary>
  447. </IndexTerm>Sending ToolTalk Messages</Title>
  448. <Para><IndexTerm>
  449. <Primary>ToolTalk messages</Primary>
  450. </IndexTerm>ToolTalk messages are simple structures that contain fields for address, subject,
  451. and delivery information. To send a ToolTalk message, an application obtains
  452. an empty message, fills in the message attributes, and sends the message. The
  453. sending application needs to provide the following information:</Para>
  454. <ItemizedList Remap="Bullet1">
  455. <ListItem>
  456. <Para>Is the message a notice or a request (that is, should the recipient respond to
  457. the message)?</Para>
  458. </ListItem>
  459. <ListItem>
  460. <Para>What interest does the recipient share with the sender? (For example, is the
  461. recipient running in a specific user session or interested in a specific file?)</Para>
  462. </ListItem>
  463. </ItemizedList>
  464. <Para>To narrow the focus of the message delivery, the sending application can
  465. provide more information in the message.</Para>
  466. </Sect2>
  467. <Sect2 Id="TTUG.Intro.div.19">
  468. <Title>Message Patterns</Title>
  469. <Para>An important ToolTalk<IndexTerm>
  470. <Primary>features, of ToolTalk</Primary>
  471. </IndexTerm>
  472. feature is that senders need to know little about the
  473. recipients because applications that want to receive messages explicitly state
  474. what message they want to receive. This information is registered with the
  475. ToolTalk service in the form of <Emphasis>message patterns</Emphasis>.</Para>
  476. <Para>Applications can provide message patterns to the ToolTalk service at
  477. installation time and while the application is running. Message patterns are
  478. created similarly to the way a message is created; both use the same type of
  479. information. For each type of message an application wants to receive, it
  480. obtains an empty message pattern, fills in the attributes, and registers the
  481. pattern with the ToolTalk service.<IndexTerm>
  482. <Primary>message patterns</Primary>
  483. </IndexTerm>
  484. These message patterns usually match the
  485. message protocols that applications have agreed to use. Applications can add
  486. more patterns for individual use.</Para>
  487. <Para>When the ToolTalk service receives a message from a sending application, it
  488. compares the information in the message to the register patterns. Once matches
  489. have been found, the ToolTalk service<IndexTerm>
  490. <Primary>messages</Primary>
  491. <Secondary>determining recipients of</Secondary>
  492. </IndexTerm>
  493. delivers copies of the message to all
  494. recipients.</Para>
  495. <Para>For each pattern that describes a message an application wants to receive, the
  496. application declares whether it can <Emphasis><IndexTerm>
  497. <Primary>messages</Primary>
  498. <Secondary>handling</Secondary>
  499. </IndexTerm>handle</Emphasis> or <Emphasis><IndexTerm>
  500. <Primary>messages</Primary>
  501. <Secondary>observing</Secondary>
  502. </IndexTerm>observe</Emphasis> the message. Although
  503. many applications can observe a message, only one application can handle the
  504. message to ensure that a requested operation is performed only once. If the
  505. ToolTalk service cannot find a handler for a request, it returns the message to
  506. the sending application indicating that delivery failed.</Para>
  507. </Sect2>
  508. <Sect2 Id="TTUG.Intro.div.20">
  509. <Title><IndexTerm>
  510. <Primary>receiving ToolTalk messages</Primary>
  511. </IndexTerm><IndexTerm>
  512. <Primary>messages</Primary>
  513. <Secondary>receiving</Secondary>
  514. </IndexTerm>Receiving ToolTalk Messages</Title>
  515. <Para>When the ToolTalk service determines that a message needs to be delivered to
  516. a specific process, it creates a copy of the message and notifies the process that
  517. a message is waiting. If a receiving application is not running, the ToolTalk
  518. service looks for instructions (provided by the application at installation time)
  519. on how to start the application.</Para>
  520. <Para>The process retrieves the message and examines its contents.</Para>
  521. <ItemizedList Remap="Bullet1">
  522. <ListItem>
  523. <Para>If the message contains a notice that an operation has been performed, the
  524. process reads the information and then discards the message.</Para>
  525. </ListItem>
  526. <ListItem>
  527. <Para>If the message contains a request to perform an operation, the process
  528. performs the operation and returns the result of the operation in a reply to
  529. the original message. Once the reply has been sent, the process discards the
  530. original message.</Para>
  531. </ListItem>
  532. </ItemizedList>
  533. </Sect2>
  534. </Sect1>
  535. <Sect1 Id="TTUG.Intro.div.21">
  536. <Title>ToolTalk Message Distribution</Title>
  537. <Para>The ToolTalk service provides two methods of<IndexTerm>
  538. <Primary>addressing messages, methods of</Primary>
  539. </IndexTerm><IndexTerm>
  540. <Primary>messages</Primary>
  541. <Secondary>methods of addressing</Secondary>
  542. </IndexTerm>
  543. addressing messages:
  544. <Emphasis>process&hyphen;oriented</Emphasis> messages and <Emphasis>object-oriented</Emphasis> messages.</Para>
  545. <Sect2 Id="TTUG.Intro.div.22">
  546. <Title>Process-Oriented Messages</Title>
  547. <Para><IndexTerm>
  548. <Primary>process-oriented messages</Primary>
  549. </IndexTerm><IndexTerm>
  550. <Primary>messages</Primary>
  551. <Secondary>process-oriented</Secondary>
  552. </IndexTerm>Process-oriented messages are addressed to processes. Applications that create
  553. a process-oriented message address the message to either a specific process or
  554. to a particular type of process. Process-oriented messages are a good way for
  555. existing applications to begin communication with other applications.
  556. Modifications to support process-oriented messages are straightforward and
  557. usually take a short time to implement.</Para>
  558. </Sect2>
  559. <Sect2 Id="TTUG.Intro.div.23">
  560. <Title>Object-Oriented Messages</Title>
  561. <Para><IndexTerm>
  562. <Primary>object-oriented messages</Primary>
  563. </IndexTerm><IndexTerm>
  564. <Primary>messages</Primary>
  565. <Secondary>object-oriented</Secondary>
  566. </IndexTerm>Object-oriented messages are addressed to objects managed by applications.
  567. Applications that create an object-oriented message address the message to
  568. either a specific object or to a particular type of object. Object-oriented
  569. messages are particularly useful for applications that currently use objects or
  570. that are to be designed around objects. If an existing application is not
  571. object&hyphen;oriented, the ToolTalk service allows applications to identify portions of
  572. application data as objects so that applications can begin to communicate about
  573. these objects.</Para>
  574. <Note>
  575. <Para>Programs coded to the ToolTalk object-oriented messaging interface are
  576. <Symbol Role="Variable">not</Symbol> portable to<IndexTerm>
  577. <Primary>OMG-compliant systems</Primary>
  578. </IndexTerm>
  579. CORBA&hyphen;compliant systems without source changes.</Para>
  580. </Note>
  581. </Sect2>
  582. <Sect2 Id="TTUG.Intro.div.24">
  583. <Title>Determining Message Delivery</Title>
  584. <Para>To<IndexTerm>
  585. <Primary>determining who receive messages</Primary>
  586. </IndexTerm>
  587. determine which groups receive messages, you <Emphasis>scope</Emphasis> your messages.
  588. Scoping limits the delivery of messages to a particular session or file.</Para>
  589. <Sect3 Id="TTUG.Intro.div.25">
  590. <Title>Sessions</Title>
  591. <Para>A<IndexTerm>
  592. <Primary>session, ToolTalk concept of</Primary>
  593. </IndexTerm>
  594. <Emphasis>session</Emphasis> is a group of processes that have an instance of the ToolTalk message
  595. server in common (refer to Appendix C for information on thread-safe session management).
  596. When a process opens communication with the ToolTalk
  597. service, a default session is located (or created, if a session does not already
  598. exist) and a <Emphasis>process identifier</Emphasis> (<Emphasis>procid</Emphasis>) is assigned to the process. Default sessions
  599. are located either through an environment variable (called &ldquo;process tree
  600. sessions&rdquo;) or through the X display (called &ldquo;X sessions&rdquo;).</Para>
  601. <Para>The concept of a session is important in the delivery of messages. Senders can
  602. scope a message to a session and the ToolTalk service will deliver it to all
  603. processes that have message patterns that reference the current session. To
  604. update message patterns with the current<IndexTerm>
  605. <Primary>session identifier (sessid)</Primary>
  606. </IndexTerm>
  607. <Emphasis>session identifier</Emphasis> (sessid), applications
  608. join the session.</Para>
  609. </Sect3>
  610. <Sect3 Id="TTUG.Intro.div.26">
  611. <Title>Files</Title>
  612. <Para>A container for data that is of interest to applications is called a<IndexTerm>
  613. <Primary>files</Primary>
  614. <Secondary>ToolTalk concept of</Secondary>
  615. </IndexTerm>
  616. <Symbol Role="Variable">file</Symbol> in this
  617. book.</Para>
  618. <Para>The concept of a file is important in the delivery of messages. Senders can
  619. scope a message to a file and the ToolTalk service will deliver it to all processes
  620. that have message patterns that reference the file without regard to the
  621. process's default session. To update message patterns with the current file path
  622. name, applications join the file.</Para>
  623. <Para>You can also scope a message to a file within a session. The ToolTalk service
  624. will deliver the message to all processes that reference both the file and session
  625. in their message patterns.</Para>
  626. <Note>
  627. <Para>The<IndexTerm>
  628. <Primary>file scoping, restrictions</Primary>
  629. </IndexTerm>
  630. file scoping feature is restricted to NFS&reg; and UFS file systems.</Para>
  631. </Note>
  632. </Sect3>
  633. </Sect2>
  634. </Sect1>
  635. <Sect1 Id="TTUG.Intro.div.27">
  636. <Title><IndexTerm>
  637. <Primary>modifying your application to use the ToolTalk service</Primary>
  638. </IndexTerm>Modifying Applications to Use the ToolTalk Service</Title>
  639. <Para>Before you modify your application to use the ToolTalk service, you must
  640. define (or locate) a ToolTalk<IndexTerm>
  641. <Primary>message protocol</Primary>
  642. </IndexTerm>
  643. <Emphasis>message protocol</Emphasis>: a set of ToolTalk messages that
  644. describe operations applications agree to perform. The message protocol
  645. specification includes the set of messages and how applications should behave
  646. when they receive the messages.</Para>
  647. <Para>To use the ToolTalk service, an application calls ToolTalk functions from the
  648. ToolTalk<IndexTerm>
  649. <Primary>application programming interface (API)</Primary>
  650. </IndexTerm>
  651. API. The ToolTalk API provides functions to register with the ToolTalk
  652. service, to create message patterns, to send messages, to receive messages, to
  653. examine message information, and so on. To modify your application to use
  654. the ToolTalk service, you must first include the ToolTalk API header file in your
  655. program. You also need to modify your application to:</Para>
  656. <ItemizedList Remap="Bullet1">
  657. <ListItem>
  658. <Para>Initialize the ToolTalk service and join a session</Para>
  659. </ListItem>
  660. <ListItem>
  661. <Para>Register message patterns with the ToolTalk service</Para>
  662. </ListItem>
  663. <ListItem>
  664. <Para>Send and receive messages</Para>
  665. </ListItem>
  666. <ListItem>
  667. <Para>Unregister message patterns and leave your ToolTalk session</Para>
  668. </ListItem>
  669. </ItemizedList>
  670. </Sect1>
  671. </Chapter>
  672. <!--fickle 1.14 mif-to-docbook 1.7 01/02/96 05:02:32-->