View Javadoc

1   // Copyright 2003-2005 Arthur van Hoff, Rick Blair
2   // Licensed under Apache License version 2.0
3   // Original license LGPL
4   
5   package javax.jmdns;
6   
7   import java.util.EventListener;
8   
9   /**
10   * Listener for service updates.
11   *
12   * @author Arthur van Hoff, Werner Randelshofer, Pierre Frisch
13   */
14  public interface ServiceListener extends EventListener {
15      /**
16       * A service has been added.<br/>
17       * <b>Note:</b>This event is only the service added event. The service info associated with this event does not include resolution information.<br/>
18       * To get the full resolved information you need to listen to {@link #serviceResolved(ServiceEvent)} or call {@link JmDNS#getServiceInfo(String, String, long)}
19       *
20       * <pre>
21       *  ServiceInfo info = event.getDNS().getServiceInfo(event.getType(), event.getName())
22       * </pre>
23       * <p>
24       * Please note that service resolution may take a few second to resolve.
25       * </p>
26       *
27       * @param event
28       *            The ServiceEvent providing the name and fully qualified type of the service.
29       */
30      void serviceAdded(ServiceEvent event);
31  
32      /**
33       * A service has been removed.
34       *
35       * @param event
36       *            The ServiceEvent providing the name and fully qualified type of the service.
37       */
38      void serviceRemoved(ServiceEvent event);
39  
40      /**
41       * A service has been resolved. Its details are now available in the ServiceInfo record.<br/>
42       * <b>Note:</b>This call back will never be called if the service does not resolve.<br/>
43       *
44       * @param event
45       *            The ServiceEvent providing the name, the fully qualified type of the service, and the service info record.
46       */
47      void serviceResolved(ServiceEvent event);
48  
49  }