Go to the documentation of this file.00001
00004 package javax.jmdns.impl;
00005
00006 import java.net.InetAddress;
00007
00011 public interface NameRegister {
00012
00016 public enum NameType {
00020 HOST,
00024 SERVICE,
00025 }
00026
00027 public static class UniqueNamePerInterface implements NameRegister {
00028
00029
00030
00031
00032
00033 @Override
00034 public void register(InetAddress networkInterface, String name, NameType type) {
00035
00036
00037 }
00038
00039
00040
00041
00042
00043 @Override
00044 public boolean checkName(InetAddress networkInterface, String name, NameType type) {
00045
00046 return false;
00047 }
00048
00049
00050
00051
00052
00053 @Override
00054 public String incrementHostName(InetAddress networkInterface, String name, NameType type) {
00055
00056 return null;
00057 }
00058
00059 }
00060
00061 public static class UniqueNameAcrossInterface implements NameRegister {
00062
00063
00064
00065
00066
00067 @Override
00068 public void register(InetAddress networkInterface, String name, NameType type) {
00069
00070
00071 }
00072
00073
00074
00075
00076
00077 @Override
00078 public boolean checkName(InetAddress networkInterface, String name, NameType type) {
00079
00080 return false;
00081 }
00082
00083
00084
00085
00086
00087 @Override
00088 public String incrementHostName(InetAddress networkInterface, String name, NameType type) {
00089
00090 return null;
00091 }
00092
00093 }
00094
00095 public static class Factory {
00096
00097 private static volatile NameRegister _register;
00098
00107 public static void setRegistry(NameRegister register) throws IllegalStateException {
00108 if (_register != null) {
00109 throw new IllegalStateException("The register can only be set once.");
00110 }
00111 if (register != null) {
00112 _register = register;
00113 }
00114 }
00115
00121 public static NameRegister getRegistry() {
00122 if (_register == null) {
00123 _register = new UniqueNamePerInterface();
00124 }
00125 return _register;
00126 }
00127
00128 }
00129
00140 public abstract void register(InetAddress networkInterface, String name, NameType type);
00141
00153 public abstract boolean checkName(InetAddress networkInterface, String name, NameType type);
00154
00166 public abstract String incrementHostName(InetAddress networkInterface, String name, NameType type);
00167
00168 }