[openi18n-im:01448] IM_FILE_OPERATION implementation
AShiZaWa KaZuNoRi <[email protected]> Wed, 29 Jun 2005 16:03:34 +0900
| Newsgroups | gmane.comp.internationalization.input-methods |
|---|---|
| Message-ID | <[email protected]> |
Hi all, Attached is my idea how IM_FILE_OPERATION will be implemented. Any comments and suggestions are welcome. Thanks, -- kasha
file-operation-agent.txt
(text/plain, 7 KB)
[Preliminary] IM_FILE_OPERATION implementation
New interfaces:
/usr/lib/iiim/iiim-fop File Operation Agent program
/usr/lib/iiim/add-in/fop-client.so IM_FILE_OPERATION server module
/usr/lib/iiim/add-in/fop-mapping.so Namespace based file I/O mapping module
/etc/iiim/fop_ns_map.xml Namespace based file I/O mapping rule
${HOME}/.iiim/fop_ns_map.xml Namespace based file I/O mapping rule
IM_FILE_OPERATION IIIMP message
IM_FILE_OPERATION_REPLY IIIMP message
FILE_OPERATION_* IIIMP data types
IIIM_FILE_OPERATION_AGENT_ID Environment variable
IIIM_FILE_OPERATION_AGENT_ID X atom
Existing interfaces to be changed:
/usr/bin/iiimd IIIM server program
/usr/bin/iiimx IIIM client watchdog
/usr/lib/iiim/xiiimp.so IIIM X client framework module
/usr/lib/libiiimp.so IIIM protocol library
/usr/lib/libiiimcf.so IIIM client framework library
/usr/lib/gtk-2.0/2.4.0/immodules/im-iiim.so
IIIM gnome client framework module
IMATTRIBUTE IIIMP data type
Brief description of each component:
/usr/lib/iiim/iiim-fop File Operation Agent program
File Operation Agent (iiim-fop) is a stand alone program,
which accepts IM_FILE_OPERATION messages from iiimd, and
performs requested file operations.
iiim-fop loads fop-mapping.so to parse fop-ns-map.xml. The
information will be used to control requests from iiimd.
/usr/lib/iiim/add-in/fop-client.so IM_FILE_OPERATION server module
Add-in shared object, which will be loaded by iiimd. There
are three reasons to make this module add-in.
1. To avoid affecting other development tasks. If this
function is implemented as an add-in shared object, it is
easy to disable the feature: just remove the shared
object. No need to rebuild iiimd binary.
2. To enforce clean development. If this function is
implemented as an add-in shared object, all interfaces
between iiimd and fop-client.so must be clearly defined.
This practice should reduce the risk of human error and
design error.
3. Sample implementation for future implementation of other
schemes, such as database and LDAP.
/usr/lib/iiim/add-in/fop-mapping.so Namespace based file I/O mapping module
Add-in shared object, which will be loaded by iiimd and
iiim-fop. There are three reasons to make this module
add-in.
1. To avoid affecting other development tasks. If this
function is implemented as an add-in shared object, it is
easy to disable the feature: just remove the shared
object. No need to rebuild iiimd binary.
2. To enforce clean development. If this function is
implemented as an add-in shared object, all interfaces
between iiimd and fop-mapping.so must be clearly defined.
This practice should reduce the risk of human error and
design error.
3. To avoid duplicate implementation in iiimd and iiim-fop.
fop-mapping.so will be linked with libxml2 to parse mapping
rule files.
/etc/iiim/fop-ns-map.xml Namespace based file I/O mapping rule
${HOME}/.iiim/fop-ns-map.xml Namespace based file I/O mapping rule
Define namespace based file I/O mapping rule using XML.
IM_FILE_OPERATION IIIMP message
IM_FILE_OPERATION_REPLY IIIMP message
IIIMP messages.
FILE_OPERATION_* IIIMP data types
IIIMP data types for IM_FILE_OPERATION and
IM_FILE_OPERATION_REPLY messages.
IIIM_FILE_OPERATION_AGENT_ID Environment variable
An environment variable to pass FILE_OPERATION_AGENT_ID to
IIIM clients.
IIIM_FILE_OPERATION_AGENT_ID X atom
An X atom to pass FILE_OPERATION_AGENT_ID to X-aware IIIM
clients.
/usr/bin/iiimd IIIM server program
- loads fop-mapping.so.
- loads fop-client.so.
- fop_*() will be enabled.
- recognize FILE_OPERATION_AGENT_ID.
- use condition variables to sync a thread, which is bound
to iiim-fop, with other threads, that are bound to normal
IIIM clients.
/usr/bin/iiimx IIIM client watchdog
- generates FILE_OPERATION_AGENT_ID.
- propagates FILE_OPERATION_AGENT_ID to iiim-fop, iiim-xbe,
and other IIIM clients.
/usr/lib/iiim/xiiimp.so IIIM X client framework module
- add support for FILE_OPERATION_AGENT_ID.
/usr/lib/libiiimp.so IIIM protocol library
- implements IM_FILE_OPERATION and IM_FILE_OPERATION_REPLY.
- add support for FILE_OPERATION_AGENT_ID.
/usr/lib/libiiimcf.so IIIM client framework library
- add support for IM_FILE_OPERATION*.
- add support for FILE_OPERATION_AGENT_ID.
/usr/lib/gtk-2.0/2.4.0/immodules/im-iiim.so
IIIM gnome client framework module
- add support for FILE_OPERATION_AGENT_ID.
IMATTRIBUTE IIIMP data type
- add support for FILE_OPERATION_AGENT_ID.
Senario:
1. iiimd loads all add-ins during its startup.
2. a user logins, then iiimx starts for the user.
3. iiimx generates FILE_OPERATION_AGENT_ID value.
4. iiimx starts iiim-fop with FILE_OPERATION_AGENT_ID value.
5. iiim-fop connects to iiimd, and pass FILE_OPERATION_AGENT_ID
value to iiimd.
6. iiimd creates a desktop(A) for iiim-fop.
7. iiimd reads ${HOME}/.iiim/fop_ns_map.xml thou iiim-fop, if
the file is available. Map(A).
8. iiimd reads /etc/iiim/fop_ns_map.xml, if the file is
available. Map(B).
9. iiimx starts iiim-xbe with FILE_OPERATION_AGENT_ID value.
10. iiim-xbe connects to iiimd, and pass FILE_OPERATION_AGENT_ID
value to iiim.
11. iiimd creates a desktop(B) for iiim-xbe.
12. iiimx exports FILE_OPERATION_AGENT_ID value for other IIIM
clients.
13. an IIIM client starts, connects to iiimd, and passes
FILE_OPERATION_AGENT_ID value to iiimd.
14. iiimd associates the client with the desktop(B).
15. an LE issues a file operation request to iiimd for the
desktop(B).
16. iiimd lookups map(A) and map(B), then determines that the
request should be redirected to iiim-fop.
17. iiimd thread retrieve FILE_OPERATION_AGENT_ID value for the
desktop(B), and find a thread for the desktop(A) which has
the same FILE_OPERATION_AGENT_ID value.
18. iiimd thread which is associated with the desktop(B)
requests a thread, which is associated with the desktop(A),
to perform the file operation.
19. the thread which is associated with the desktop(A) will
issue IM_FILE_OPERATION request to iiim-fop.
...
20. the user logouts, all IIIM clients exit, except for
iiim-fop.
21. iiimd destroys the desktop(B).
22. an LE issues file operation requests in if_CloseDesktop().
23. iiimd forwards the requests to iiim-fop.
24. iiimd notifies iiim-fop that the desktop(B) is destroyed.
25. iiim-fop exits.
26. iiimd destroys the desktop(A).