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 the 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, such as 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 client. 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.

2. Convenience Classes

The class AbstractEntry is a subclass of Entry, and is designed as a convenience class. It implements methods such as equals() and toString(). Hoever, it doesn't really seem to add much that would justify using it, in my opinion.

In addtion, Sun's implementation of Jini contains a further set of convenience classes, all subclassed out of Entry. They are

For example, the Address class contains


String country;
String locality;           // City or locality name.
String organization;       // Name of the company or organization that provides this service.
String organizationalUnit; // The unit within the organization that provides this service.
String postalCode;         // Postal code.
String stateOrProvince;    // Full name or standard postal abbreviation of a state or province.
String street;             //Street address.
You may find these classes useful; on the other hand, what services would like to advertise, and what clients woud like to match on is pretty much unknown as yet. These classes are not part of the formal Jini specification.

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.