/** * Register a service type. If this service type was not already known, * all service listeners will be notified of the new service type. Service types * are automatically registered as they are discovered. */ public void registerServiceType(String type) { String name = type.toLowerCase(); if (serviceTypes.get(name) == null) { if ((type.indexOf("._mdns._udp.") < 0) && !type.endsWith(".in-addr.arpa.")) { Collection list; synchronized (this) { serviceTypes.put(name, type); list = new LinkedList(typeListeners); } for (Iterator iterator = list.iterator(); iterator.hasNext();) { ((ServiceTypeListener) iterator.next()).serviceTypeAdded(new ServiceEvent(this, type, null, null)); } } } }
/** * A new subtype for the service type was discovered. * * <pre> * <sub>._sub.<app>.<protocol>.<servicedomain>.<parentdomain>. * </pre> * * @param event * The service event providing the fully qualified type of the service with subtype. */ void subTypeForServiceTypeAdded(ServiceEvent event) { if (null == _addedTypes.putIfAbsent(event.getType(), event.getType())) { this.getListener().subTypeForServiceTypeAdded(event); } else { logger.finest("Service Sub Type Added called for a service sub type already added: " + event); } }
/** * A new subtype for the service type was discovered. * * <pre> * <sub>._sub.<app>.<protocol>.<servicedomain>.<parentdomain>. * </pre> * * @param event * The service event providing the fully qualified type of the service with subtype. */ void subTypeForServiceTypeAdded(ServiceEvent event) { if (null == _addedTypes.putIfAbsent(event.getType(), event.getType())) { this.getListener().subTypeForServiceTypeAdded(event); } else { logger.trace("Service Sub Type Added called for a service sub type already added: {}", event); } }
/** * Listen for service types. * * @param listener listener for service types */ public void addServiceTypeListener(ServiceTypeListener listener) throws IOException { synchronized (this) { typeListeners.remove(listener); typeListeners.add(listener); } // report cached service types for (Iterator iterator = serviceTypes.values().iterator(); iterator.hasNext();) { listener.serviceTypeAdded(new ServiceEvent(this, (String) iterator.next(), null, null)); } new TypeResolver().start(); }
/** * A new subtype for the service type was discovered. * * <pre> * <sub>._sub.<app>.<protocol>.<servicedomain>.<parentdomain>. * </pre> * * @param event * The service event providing the fully qualified type of the service with subtype. */ void subTypeForServiceTypeAdded(ServiceEvent event) { if (null == _addedTypes.putIfAbsent(event.getType(), event.getType())) { this.getListener().subTypeForServiceTypeAdded(event); } else { logger.finest("Service Sub Type Added called for a service sub type already added: " + event); } }
/** * A new service type was discovered. * * @param event * The service event providing the fully qualified type of the service. */ void serviceTypeAdded(ServiceEvent event) { if (null == _addedTypes.putIfAbsent(event.getType(), event.getType())) { this.getListener().serviceTypeAdded(event); } else { logger.finest("Service Type Added called for a service type already added: " + event); } }
/** * A new subtype for the service type was discovered. * * <pre> * <sub>._sub.<app>.<protocol>.<servicedomain>.<parentdomain>. * </pre> * * @param event * The service event providing the fully qualified type of the service with subtype. */ void subTypeForServiceTypeAdded(ServiceEvent event) { if (null == _addedTypes.putIfAbsent(event.getType(), event.getType())) { this.getListener().subTypeForServiceTypeAdded(event); } else { logger.finest("Service Sub Type Added called for a service sub type already added: " + event); } }
/** * A new service type was discovered. * * @param event * The service event providing the fully qualified type of the service. */ void serviceTypeAdded(ServiceEvent event) { if (null == _addedTypes.putIfAbsent(event.getType(), event.getType())) { this.getListener().serviceTypeAdded(event); } else { logger.trace("Service Type Added called for a service type already added: {}", event); } }
/** * A new service type was discovered. * * @param event * The service event providing the fully qualified type of the service. */ void serviceTypeAdded(ServiceEvent event) { if (null == _addedTypes.putIfAbsent(event.getType(), event.getType())) { this.getListener().serviceTypeAdded(event); } else { logger.finest("Service Type Added called for a service type already added: " + event); } }
/** * A new service type was discovered. * * @param event * The service event providing the fully qualified type of the service. */ void serviceTypeAdded(ServiceEvent event) { if (null == _addedTypes.putIfAbsent(event.getType(), event.getType())) { this.getListener().serviceTypeAdded(event); } else { logger.finest("Service Type Added called for a service type already added: " + event); } }