ServiceRegistrar
.
This is a proxy for the lookup service
public interface ServiceRegistrar {
public ServiceRegistration register(ServiceItem i,
long leaseDuration);
public Object lookup(ServiceTemplate tmpl);
public ServiceMatches lookup(ServiceTemplate tmpl, int maxMatches);
LookupLocator getLocator();
}
register()
method is used by a service
lookup()
methods are used by a client.
The first returns a single service, the second a set of services
getLocator()
method can say where the lookup service is
Entry
public interface Entry {}
Address
Comment
Name
ServiceInfo
Entry[] entries = new Entry[] {new Comment("best toaster made"),
new Name("Classy Toaster")};
public class MIMEType implements java.io.Serializable {
protected String contentType;
protected String subType;
public MIMEType(String contentTpe, String subType) {...}
public String toString() {...}
}
(It may need to be serialized, to move it from one machine to another)
The full class is at
http://jan.newmarch.name/java/jini/tutorial/SimpleExample.xml
public interface FileClassifier {
MIMEType getMIMEType(String fileName)
throws java.rmi.RemoteException;
}
(The method may be executing remotely, so can throw a remote exception)
FileClassifier
FileClassifierImpl
FileClassifierImpl
FileClassifier
FileClassifierImpl
FileClassifierimpl_Stub
is exported to the service locator
FileClassifier
(like before - it
doesn't care what the proxy is)
FileClassifierImpl
and a FileClassifierProxy
FileClassifierProxy
FileClassifier
FileClassifierImpl
and a FileClassifierProxy
FileClassifierProxy
and a FileClassifierImpl_Stub
Jan Newmarch A Programmers Guide to Jini