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.EventObject;
8   
9   /**
10   *
11   */
12  public abstract class ServiceEvent extends EventObject implements Cloneable {
13  
14      /**
15       *
16       */
17      private static final long serialVersionUID = -8558445644541006271L;
18  
19      /**
20       * Constructs a Service Event.
21       * 
22       * @param eventSource
23       *            The object on which the Event initially occurred.
24       * @exception IllegalArgumentException
25       *                if source is null.
26       */
27      public ServiceEvent(final Object eventSource) {
28          super(eventSource);
29      }
30  
31      /**
32       * Returns the JmDNS instance which originated the event.
33       * 
34       * @return JmDNS instance
35       */
36      public abstract JmDNS getDNS();
37  
38      /**
39       * Returns the fully qualified type of the service.
40       * 
41       * @return type of the service.
42       */
43      public abstract String getType();
44  
45      /**
46       * Returns the instance name of the service. Always returns null, if the event is sent to a service type listener.
47       * 
48       * @return name of the service
49       */
50      public abstract String getName();
51  
52      /**
53       * Returns the service info record, or null if the service could not be resolved. Always returns null, if the event is sent to a service type listener.
54       * 
55       * @return service info record
56       * @see javax.jmdns.ServiceEvent#getInfo()
57       */
58      public abstract ServiceInfo getInfo();
59  
60      /*
61       * (non-Javadoc)
62       * @see java.lang.Object#clone()
63       */
64      @Override
65      public ServiceEvent clone() {
66          try {
67              return (ServiceEvent) super.clone();
68          } catch (CloneNotSupportedException exception) {
69              // clone is supported
70              return null;
71          }
72      }
73  
74  }