Download ILU 2.0beta1 Reference Manual

Transcript
Chapter 8: Using ILU with Common Lisp
165
A kernel server may be created by instantiating the class ilu:kernel-server. The keyword argument
:id may be specified to select a name for the server. Note that ILU object IDs, which consist of the kernel
server ID, plus the instance handle of the object on that server, must be unique ‘‘across space and time’’, as
the saying goes. If no kernel server id is specified, ILU will generate one automatically, using an algorithm
that provides a high probability of uniqueness. If you explicitly specify a kernel server ID, a good technique
is to use a prefix or suffix which uniquely identifies some domain in which you can assure the uniqueness
of the remaining part of the ID. For example, when using ILU at some project called NIFTY at some
internet site in the IP domain department.company.com, one might use kernel server IDs with names
like something.NIFTY.department.company.com.
=> (make-instance ’ilu:kernel-server :id "FOO-SERVER-1")
#<ILU:KERNEL-SERVER "FOO-SERVER-1">
=> (make-instance ’ilu:kernel-server)
#<ILU:KERNEL-SERVER "121.2.100.231.1404.2c7577eb.3e5a28f">
=>
8.4.2.1 Implementation Inheritance
8.4.2.2 Exporting Objects
To export a module for use by other modules, simply instantiate one or more instances of your subtypes
of interface :otype.IMPL (which will inherit from ilu:ilu-true-object.
=> (make-instance ’foo:my-bar.impl :ilu-kernel-server s)
#<FOO:MY-BAR.IMPL 0x3b32e8 "1">
=>
The simplest Common Lisp ‘‘server’’ code would look something like:
(defun start-server ()
(make-instance ’foo:my-bar.impl))
which will create an instance of FOO:MY-BAR.IMPL and export it via a default server.
To enable users of your module find the exported objects, you may register the string binding handle of
the object or objects, along with their type IDs, in any name service or registry that is convenient for you. In
release 1.6 of ILU, we are supporting an experimental simple binding method that allows you to ‘‘publish’’
an object, which registers it in a domain-wide registry, and then to withdraw the object, if necessary.
Potential clients can find the string binding handle and type ID of the object by calling a lookup function.
Note that this interface and service is experimental, and may be supported differently in
future releases of the ILU system.
If you wanted to create an instance, and publish it, the code for starting a service might look something
like this:
(defun start-server ()