Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.fetish.directory
Interface Directory  view Directory download Directory.java

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
Fada, FadaProxy

public interface Directory
extends java.rmi.Remote

Interface with the methods that a Fetish member can invoke on the Directory.


Method Summary
 void addLookupResult(SearchIDInterface id, ServiceMatches sm)
          Adds results obtained from a remote FADA.
 ServiceMatches getServices()
          Returns all services registered in this Fada node.
 ServiceMatches lookup(SearchCriteriaInterface criteria, int nHops, long timeout, int maxResponses)
          Returns at most maxMatches items matching the template, plus the total number of items that match the template.
 boolean lookup(SearchCriteriaInterface criteria, SearchIDInterface searchID, java.lang.String target, java.lang.String excluded, int nHops, long timeout, int maxResponses)
          Extends the lookup process to all nodes connected to one (except that from which the lookup request came from).
 ServiceRegistration register(ServiceItem item, long leaseDuration)
           Register a new service or re-register an existing service.
 void startedSearches(SearchIDInterface id, int numSearches)
          Increases the number of started searches.
 void unregister(ServiceID sid)
          Deletes a registration from the node.
 

Method Detail

lookup

public ServiceMatches lookup(SearchCriteriaInterface criteria,
                             int nHops,
                             long timeout,
                             int maxResponses)
                      throws java.rmi.RemoteException
Returns at most maxMatches items matching the template, plus the total number of items that match the template. The return value is never null, and the returned items array is only null if maxMatches is zero. For each returned item, if the service object cannot be deserialized, the service field of the item is set to null and no exception is thrown. Similarly, if an attribute set cannot be deserialized, that element of the attributeSets array is set to null and no exception is thrown.


lookup

public boolean lookup(SearchCriteriaInterface criteria,
                      SearchIDInterface searchID,
                      java.lang.String target,
                      java.lang.String excluded,
                      int nHops,
                      long timeout,
                      int maxResponses)
               throws java.rmi.RemoteException
Extends the lookup process to all nodes connected to one (except that from which the lookup request came from). Takes account of the search id, to avoid cycles. If the search request has an id that is already in the list of search ids, the request is rejected, and the call returns inmediately.


addLookupResult

public void addLookupResult(SearchIDInterface id,
                            ServiceMatches sm)
                     throws java.rmi.RemoteException
Adds results obtained from a remote FADA. This method is called from a FADA node that wants to return the results of a local search to a FADA node that has asked for them.


startedSearches

public void startedSearches(SearchIDInterface id,
                            int numSearches)
                     throws java.rmi.RemoteException
Increases the number of started searches. Adds numSearches to the number of searches to expect results from. THIS METHOD IS ACTUALLY NOT BEING USED


getServices

public ServiceMatches getServices()
                           throws java.rmi.RemoteException
Returns all services registered in this Fada node.


register

public ServiceRegistration register(ServiceItem item,
                                    long leaseDuration)
                             throws java.rmi.RemoteException
Register a new service or re-register an existing service. The method is defined so that it can be used in an idempotent fashion. Specifically, if a call to register results in a RemoteException (in which case the item might or might not have been registered), the caller can simply repeat the call to register with the same parameters, until it succeeds.

To register a new service, item.serviceID should be null. In that case, if item.service does not equal (using MarshalledObject.equals) any existing item's service object, then a new service ID will be assigned and included in the returned ServiceRegistration. The service ID is unique over time and space with respect to all other service IDs generated by all lookup services. If item.service does equal an existing item's service object, the existing item is first deleted from the lookup service (even if it has different attributes) and its lease is cancelled, but that item's service ID is reused for the newly registered item.

To re-register an existing service, or to register the service in any other lookup service, item.serviceID should be set to the same service ID that was returned by the initial registration. If an item is already registered under the same service ID, the existing item is first deleted (even if it has different attributes or a different service instance) and its lease is cancelled. Note that service object equality is not checked in this case, to allow for reasonable evolution of the service (e.g., the serialized form of the stub changes, or the service implements a new interface).

Any duplicate attribute sets included in a service item are eliminated in the stored representation of the item. The lease duration request is not exact; the returned lease is allowed to have a shorter (but not longer) duration than what was requested.


unregister

public void unregister(ServiceID sid)
                throws java.rmi.RemoteException
Deletes a registration from the node.