Package javax.jmdns

Examples of javax.jmdns.ServiceInfo


        // if (DNSRecordType.TYPE_PTR.equals(rec.getRecordType()) || DNSRecordType.TYPE_SRV.equals(rec.getRecordType()))
        {
            ServiceEvent event = rec.getServiceEvent(this);
            if ((event.getInfo() == null) || !event.getInfo().hasData()) {
                // We do not care about the subtype because the info is only used if complete and the subtype will then be included.
                ServiceInfo info = this.getServiceInfoFromCache(event.getType(), event.getName(), "", false);
                if (info.hasData()) {
                    event = new ServiceEventImpl(this, event.getType(), event.getName(), info);
                }
            }

            List<ServiceListenerStatus> list = _serviceListeners.get(event.getType().toLowerCase());
View Full Code Here


         *            service event
         */
        @Override
        public void serviceAdded(ServiceEvent event) {
            synchronized (this) {
                ServiceInfo info = event.getInfo();
                if ((info != null) && (info.hasData())) {
                    _infos.put(event.getName(), info);
                } else {
                    String subtype = (info != null ? info.getSubtype() : "");
                    info = ((JmDNSImpl) event.getDNS()).resolveServiceInfo(event.getType(), event.getName(), subtype, true);
                    if (info != null) {
                        _infos.put(event.getName(), info);
                    } else {
                        _events.put(event.getName(), event);
View Full Code Here

  @SuppressWarnings("resource")
  JmDNS dns = serviceEvent.getDNS();

  dns.requestServiceInfo(type, name);
  ServiceInfo serviceInfo = dns.getServiceInfo(type, name);
  if (serviceInfo != null) {
      dns.requestServiceInfo(type, name);
  }

    }
View Full Code Here

  }
    }

    @Override
    public void serviceResolved(ServiceEvent serviceEvent) {
  ServiceInfo info = serviceEvent.getInfo();
  for (InetAddress inetAddress : info.getInet4Addresses()) {
      bonour newItem = new bonour();
      newItem.address = inetAddress.getHostAddress();
      newItem.name = serviceEvent.getName();
      if (info.hasData()) {
    newItem.board = info.getPropertyString("board");
    newItem.distroversion = info.getPropertyString("distro_version");
    newItem.name = info.getServer();
      }
      while (newItem.name.endsWith(".")) {
    newItem.name = newItem.name.substring(0, newItem.name.length() - 1);
      }
      newItem.port = Integer.toString(info.getPort());

      synchronized (this) {
    removeBoardswithSameAdress(newItem);
    myComPorts.add(newItem);
      }
View Full Code Here

    @Override
    public void stop() {
        if (jmdns != null) {
            for (Iterator<ServiceInfo> iter = serviceInfos.iterator(); iter.hasNext();) {
                ServiceInfo si = iter.next();
                jmdns.unregisterService(si);
            }

            // Close it down async since this could block for a while.
            final JmDNS closeTarget = jmdns;
View Full Code Here

        }
    }

    @Override
    public void registerService(String name) throws IOException {
        ServiceInfo si = createServiceInfo(name, new HashMap<String, Object>());
        serviceInfos.add(si);
        getJmdns().registerService(si);
    }
View Full Code Here

        int port = MapHelper.getInt(map, "port", 0);

        if (log.isDebugEnabled()) {
            log.debug("Registering service type: " + type + " name: " + name + " details: " + map);
        }
        return new ServiceInfo(type, name, port, weight, priority, new Hashtable(map));
    }
View Full Code Here

                JmDNS dns = event.getDNS();
                String type = event.getType();
                String name = event.getName();

                dns.requestServiceInfo(type, name);
                ServiceInfo info = dns.getServiceInfo(type, name);
                if (info != null) {
                    addToZooKeeper(info);
                }
            }

            public void serviceRemoved(ServiceEvent event) {
                log("Removed", event);
                removeFromZooKeper(event);
            }

            public void serviceResolved(ServiceEvent event) {
                log("Resolved", event);
                ServiceInfo info = event.getInfo();
                if (info != null) {
                    addToZooKeeper(info);
                }
            }
        };
View Full Code Here


    public void stop() {
        if (jmdns != null) {
            for (Iterator<ServiceInfo> iter = serviceInfos.iterator(); iter.hasNext(); ) {
                ServiceInfo si = iter.next();
                jmdns.unregisterService(si);
            }

            // Close it down async since this could block for a while.
            final JmDNS closeTarget = jmdns;
View Full Code Here

            jmdns = null;
        }
    }

    public void registerService(String name, int port, String type) throws IOException {
        ServiceInfo si = createServiceInfo(name, new HashMap(), port, type);
        registerService(si);
    }
View Full Code Here

TOP

Related Classes of javax.jmdns.ServiceInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.