Go to the documentation of this file.00001
00004 package javax.jmdns;
00005
00006 import java.io.Closeable;
00007 import java.io.IOException;
00008 import java.net.InetAddress;
00009 import java.util.Map;
00010 import java.util.concurrent.atomic.AtomicReference;
00011
00012 import javax.jmdns.impl.JmmDNSImpl;
00013
00027 public interface JmmDNS extends Closeable {
00028
00032 public static final class Factory {
00033 private static volatile JmmDNS _instance;
00034
00038 public static interface ClassDelegate {
00039
00047 public JmmDNS newJmmDNS();
00048
00049 }
00050
00051 private static final AtomicReference<ClassDelegate> _databaseClassDelegate = new AtomicReference<ClassDelegate>();
00052
00053 private Factory() {
00054 super();
00055 }
00056
00065 public static void setClassDelegate(ClassDelegate delegate) {
00066 _databaseClassDelegate.set(delegate);
00067 }
00068
00076 public static ClassDelegate classDelegate() {
00077 return _databaseClassDelegate.get();
00078 }
00079
00085 protected static JmmDNS newJmmDNS() {
00086 JmmDNS dns = null;
00087 ClassDelegate delegate = _databaseClassDelegate.get();
00088 if (delegate != null) {
00089 dns = delegate.newJmmDNS();
00090 }
00091 return (dns != null ? dns : new JmmDNSImpl());
00092 }
00093
00099 public static JmmDNS getInstance() {
00100
00101
00102
00103 if ( (_instance == null) || ( _instance.isClosed() ) ) {
00104 synchronized (Factory.class) {
00105 _instance = JmmDNS.Factory.newJmmDNS();
00106 }
00107 }
00108 return _instance;
00109 }
00110 }
00111
00115 public abstract boolean isClosed();
00116
00123 public abstract String[] getNames();
00124
00131 public abstract String[] getHostNames();
00132
00140 public abstract InetAddress[] getInetAddresses() throws IOException;
00141
00150 @Deprecated
00151 public abstract InetAddress[] getInterfaces() throws IOException;
00152
00165 public abstract ServiceInfo[] getServiceInfos(String type, String name);
00166
00181 public abstract ServiceInfo[] getServiceInfos(String type, String name, long timeout);
00182
00197 public abstract ServiceInfo[] getServiceInfos(String type, String name, boolean persistent);
00198
00215 public abstract ServiceInfo[] getServiceInfos(String type, String name, boolean persistent, long timeout);
00216
00226 public abstract void requestServiceInfo(String type, String name);
00227
00239 public abstract void requestServiceInfo(String type, String name, boolean persistent);
00240
00252 public abstract void requestServiceInfo(String type, String name, long timeout);
00253
00267 public abstract void requestServiceInfo(String type, String name, boolean persistent, long timeout);
00268
00277 public abstract void addServiceTypeListener(ServiceTypeListener listener) throws IOException;
00278
00286 public abstract void removeServiceTypeListener(ServiceTypeListener listener);
00287
00297 public abstract void addServiceListener(String type, ServiceListener listener);
00298
00308 public abstract void removeServiceListener(String type, ServiceListener listener);
00309
00319 public abstract void registerService(ServiceInfo info) throws IOException;
00320
00328 public abstract void unregisterService(ServiceInfo info);
00329
00335 public abstract void unregisterAllServices();
00336
00344 public abstract void registerServiceType(String type);
00345
00354 public abstract ServiceInfo[] list(String type);
00355
00366 public abstract ServiceInfo[] list(String type, long timeout);
00367
00376 public abstract Map<String, ServiceInfo[]> listBySubtype(String type);
00377
00388 public abstract Map<String, ServiceInfo[]> listBySubtype(String type, long timeout);
00389
00396 public abstract void addNetworkTopologyListener(NetworkTopologyListener listener);
00397
00404 public abstract void removeNetworkTopologyListener(NetworkTopologyListener listener);
00405
00411 public abstract NetworkTopologyListener[] networkListeners();
00412
00413 }