Entry objects

When a service registers itself, it does so with a set of attributes. Each set is given by an instance of a type or class. For example, an editor may have an attribute type of FileType:


public Class FileType implements Entry {
    public String type; // this is a MIME type

    public FileType(String type) {     
       this.type = type;
    }
}
For a text editor, the attribute set would be FileType("plain/text"). For a RTF editor, the attribute set would be FileType("application/rtf"). (Of course, there may be more than one field in the class!)

Some services may be able to handle more than one set of attributes. For example, most word-processors can handle many document types. In this case, a service is able to register an array of attribute sets, meaning that it can satisfy all of them using an array of Entry's:


Entry[] entries = new Entry[] {new FileType("plain/text"),
                               new FileType("application/rtf")
                              };

On the other side, a client wishes to find services that can handle the attributes that it requires. The client uses same Entry class for this. For any particular Entry, the client specifies

  1. Which fields must match exactly (a non-null value)
  2. Which fields it does not care about - a null value)

This is pretty crude. A printer typically has the capacity to print a certain number of pages per minute. If it specifies this, then it actually makes it rather hard to find! A client can request a printer service in which it does not care about speed, or for a particular speed. It cannot ask for printers with a speed greater than some value. It cannot ask for a printer without a capability, say, anything except a color printer. An attribute must either match exactly or be ignored. The relational operators such as `<' and `!=' are not supported.

1. Restrictions on entries

Entries are shipped around using RMI. Exported service objects are serialized, moved around by RMI and reconstituted as objects at some remote. Entries are similarly serialized and moved around by RMI, but are not reconstituted. So when it comes to comparing an entry from a service and an entry from a client request, it is the serialized forms that are compared.

An entry cannot have as field one of the primitive types such as int or char. If one of these fields is required, then it must be wrapped up in a class such as Integer or Character.

The only fields of interest are public, non-static, non-transient and non-final.

This file is Copyright ©Jan Newmarch (http://jan.newmarch.name) jan@newmarch.name

The copyright is the OpenContent License (http://www.opencontent.org/opl.shtml), which is the ``document'' version of the GNU OpenSource license.