protected ServiceInfo createServiceInfo(String name, Map map) { int port = MapHelper.getInt(map, "port", 0); String type = getType(); LOG.debug("Registering service type: {} name: {} details: {}", new Object[]{type, name, map}); return ServiceInfo.create(type, name + "." + type, port, weight, priority, ""); }
jmdns.registerService(ServiceInfo.create("_hudson._tcp.local.","jenkins", jenkins_port,0,0,props)); // for backward compatibility jmdns.registerService(ServiceInfo.create("_jenkins._tcp.local.","jenkins", jenkins_port,0,0,props)); jmdns.registerService(ServiceInfo.create("_http._tcp.local.","Jenkins", jenkins_port,0,0,props)); } catch (IOException e) {
private void registerService() throws IOException { logger.info("Registering "+SERVICE_TYPE+" on port "+port); Map<String, String> props = new HashMap<>(); props.put("sf", discoverable ? "1" : "0"); props.put("id", mac); props.put("md", label); props.put("c#", Integer.toString(configurationIndex)); props.put("s#", "1"); props.put("ff", "0"); props.put("ci", "1"); jmdns.registerService(ServiceInfo.create(SERVICE_TYPE, label, port, 1, 1, props)); }
@Override public void publishService(String name, String type, int port, HashMap<String, String> values) { try { JmDNS jmDNS = JmDNS.create(); String fullyQualitifed = type + ".local."; jmDNS.registerService(ServiceInfo.create(fullyQualitifed, name, port, 0, 0, values)); } catch (IOException e) { e.printStackTrace(); } } }
protected ServiceInfo createServiceInfo(String name, Map map) { int port = MapHelper.getInt(map, "port", 0); String type = getType(); LOG.debug("Registering service type: {} name: {} details: {}", new Object[]{type, name, map}); return ServiceInfo.create(type, name + "." + type, port, weight, priority, ""); }
protected ServiceInfo createServiceInfo(String name, Map map) { int port = MapHelper.getInt(map, "port", 0); String type = getType(); LOG.debug("Registering service type: {} name: {} details: {}", new Object[]{type, name, map}); return ServiceInfo.create(type, name + "." + type, port, weight, priority, ""); }
protected ServiceInfo createServiceInfo(String name, Map map) { int port = MapHelper.getInt(map, "port", 0); String type = getType(); LOG.debug("Registering service type: {} name: {} details: {}", new Object[]{type, name, map}); return ServiceInfo.create(type, name + "." + type, port, weight, priority, ""); }
private void registerServiceInternal(ServiceDescription description) throws IOException { for (JmDNS instance : jmdnsInstances.values()) { logger.debug("Registering new service {} at {}:{} ({})", description.serviceType, instance.getInetAddress().getHostAddress(), description.servicePort, instance.getName()); // Create one ServiceInfo object for each JmDNS instance ServiceInfo serviceInfo = ServiceInfo.create(description.serviceType, description.serviceName, description.servicePort, 0, 0, description.serviceProperties); instance.registerService(serviceInfo); } }
@Override public void registerService(ServiceDescription description) throws IOException { for (JmDNS instance : jmdnsInstances) { logger.debug("Registering new service {} at {}:{} ({})", description.serviceType, instance.getInetAddress().getHostAddress(), description.servicePort, instance.getName()); // Create one ServiceInfo object for each JmDNS instance ServiceInfo serviceInfo = ServiceInfo.create(description.serviceType, description.serviceName, description.servicePort, 0, 0, description.serviceProperties); instance.registerService(serviceInfo); } }
@Override public void unregisterService(ServiceDescription description) { activeServices.remove(description); for (JmDNS instance : jmdnsInstances.values()) { try { logger.debug("Unregistering service {} at {}:{} ({})", description.serviceType, instance.getInetAddress().getHostAddress(), description.servicePort, instance.getName()); } catch (IOException e) { logger.debug("Unregistering service {} ({})", description.serviceType, instance.getName()); } ServiceInfo serviceInfo = ServiceInfo.create(description.serviceType, description.serviceName, description.servicePort, 0, 0, description.serviceProperties); instance.unregisterService(serviceInfo); } }
@Override public void unregisterService(ServiceDescription description) { for (JmDNS instance : jmdnsInstances) { try { logger.debug("Unregistering service {} at {}:{} ({})", description.serviceType, instance.getInetAddress().getHostAddress(), description.servicePort, instance.getName()); } catch (IOException e) { logger.debug("Unregistering service {} ({})", description.serviceType, instance.getName()); } ServiceInfo serviceInfo = ServiceInfo.create(description.serviceType, description.serviceName, description.servicePort, 0, 0, description.serviceProperties); instance.unregisterService(serviceInfo); } }
@Override protected void startComponent() throws Exception { super.startComponent(); URL localEndpoint = getConfiguration().getBaseUrl(); InetAddress ip = InetAddress.getByName(localEndpoint.getHost()); m_jmDNS = JmDNS.create(ip, DISCOVERY_NAME); m_jmDNSListener = new JmDNSListener(); m_jmDNS.addServiceListener(SERVICE_TYPE, m_jmDNSListener); Map<String, Object> props = new HashMap<String, Object>(); props.put("path", localEndpoint.getPath()); ServiceInfo info = ServiceInfo.create(SERVICE_TYPE, DISCOVERY_NAME, localEndpoint.getPort(), 0, 0, props); m_jmDNS.registerService(info); }
public DNSMultiCast(Hudson hudson) { if (disabled) return; // escape hatch try { this.jmdns = JmDNS.create(); Map<String,String> props = new HashMap<String, String>(); String rootURL = hudson.getRootUrl(); if (rootURL!=null) props.put("url", rootURL); try { props.put("version",String.valueOf(Hudson.getVersion())); } catch (IllegalArgumentException e) { // failed to parse the version number } TcpSlaveAgentListener tal = hudson.getTcpSlaveAgentListener(); if (tal!=null) props.put("slave-port",String.valueOf(tal.getPort())); jmdns.registerService(ServiceInfo.create("_hudson._tcp.local.","hudson", 80,0,0,props)); } catch (IOException e) { LOGGER.log(Level.WARNING,"Failed to advertise the service to DNS multi-cast",e); } }
public DNSMultiCast(Hudson hudson) { if (disabled) return; // escape hatch try { this.jmdns = JmDNS.create(); Map<String,String> props = new HashMap<String, String>(); String rootURL = hudson.getRootUrl(); if (rootURL!=null) props.put("url", rootURL); try { props.put("version",String.valueOf(Hudson.getVersion())); } catch (IllegalArgumentException e) { // failed to parse the version number } TcpSlaveAgentListener tal = hudson.getTcpSlaveAgentListener(); if (tal!=null) props.put("slave-port",String.valueOf(tal.getPort())); jmdns.registerService(ServiceInfo.create("_hudson._tcp.local.","hudson", 80,0,0,props)); } catch (IOException e) { LOGGER.log(Level.WARNING,"Failed to advertise the service to DNS multi-cast",e); } }
jmdns.registerService(ServiceInfo.create("_hudson._tcp.local.","jenkins", jenkins_port,0,0,props)); // for backward compatibility jmdns.registerService(ServiceInfo.create("_jenkins._tcp.local.","jenkins", jenkins_port,0,0,props)); jmdns.registerService(ServiceInfo.create("_http._tcp.local.","Jenkins", jenkins_port,0,0,props)); } catch (IOException e) {
public DNSMultiCast(Hudson hudson) { if (disabled) return; // escape hatch try { this.jmdns = JmDNS.create(); Map<String,String> props = new HashMap<String, String>(); String rootURL = hudson.getRootUrl(); if (rootURL!=null) props.put("url", rootURL); try { props.put("version",String.valueOf(Hudson.getVersion())); } catch (IllegalArgumentException e) { // failed to parse the version number } TcpSlaveAgentListener tal = hudson.getTcpSlaveAgentListener(); if (tal!=null) props.put("slave-port",String.valueOf(tal.getPort())); jmdns.registerService(ServiceInfo.create("_hudson._tcp.local.","hudson", 80,0,0,props)); } catch (IOException e) { LOGGER.log(Level.WARNING,"Failed to advertise the service to DNS multi-cast",e); } }
public DNSMultiCast(Hudson hudson) { if (disabled) { return; // escape hatch } try { this.jmdns = JmDNS.create(); Map<String, String> props = new HashMap<String, String>(); String rootURL = hudson.getRootUrl(); if (rootURL != null) { props.put("url", rootURL); } try { props.put("version", String.valueOf(Hudson.getVersion())); } catch (IllegalArgumentException e) { // failed to parse the version number } TcpSlaveAgentListener tal = hudson.getTcpSlaveAgentListener(); if (tal != null) { props.put("slave-port", String.valueOf(tal.getPort())); } jmdns.registerService(ServiceInfo.create("_hudson._tcp.local.", "hudson", 80, 0, 0, props)); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to advertise the service to DNS multi-cast", e); } }
private static ServiceInfo getServiceInfo(McmDNSServiceInfo serviceInfo) { return ServiceInfo.create(serviceInfo.getType(), serviceInfo.getName(), serviceInfo.getPort(), serviceInfo.getWeight(), serviceInfo.getPriority(), serviceInfo.getProperties()); }
private static ServiceInfo getServiceInfo(McmDNSServiceInfo serviceInfo) { return ServiceInfo.create(serviceInfo.getType(), serviceInfo.getName(), serviceInfo.getPort(), serviceInfo.getWeight(), serviceInfo.getPriority(), serviceInfo.getProperties()); }
final ServiceInfo airTunesServiceInfo = ServiceInfo.create( AirtunesServiceType, HardwareAddressString + "@" + HostName + " (" + iface.getName() + ")",