|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.util.zeroconf.ZeroConfService
public class ZeroConfService
ZeroConfService objects manage a zeroConf network service advertisement.
ZeroConfService objects encapsulate zeroConf network services created using JmDNS, providing methods to start and stop service advertisements and to query service state. Typical usage would be:
ZeroConfService myService = ZeroConfService.create("_withrottle._tcp.local.", port);
or, if you do not wish to retain the ZeroConfService object:
ZeroConfService.create("_http._tcp.local.", port).publish();
ZeroConfService objects can also be created with a HashMap of properties that
are included in the TXT record for the service advertisement. This HashMap
should remain small, but it could include information such as the XMLIO path
(for a web server), the default path (also for a web server), a specific
protocol version, or other information. Note that all service advertisements
include the JMRI version, using the key "jmri".
All ZeroConfServices are automatically stopped when the JMRI application shuts down. A collection of all ZeroConfService objects is available with:
ZeroConfService.allServices().
JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
JmDNS,
ServiceInfo| Constructor Summary | |
|---|---|
protected |
ZeroConfService(javax.jmdns.ServiceInfo service)
Create a ZeroConfService object. |
| Method Summary | |
|---|---|
Collection<ZeroConfService> |
allServices()
A list of published ZeroConfServices |
static ZeroConfService |
create(String type,
int port)
Create a ZeroConfService with the minimal required settings. |
static ZeroConfService |
create(String type,
int port,
HashMap<String,String> props)
Create a ZeroConfService with an automatically detected server name. |
static ZeroConfService |
create(String type,
String name,
int port,
int weight,
int priority,
HashMap<String,String> props)
Create a ZeroConfService. |
static String |
hostName()
Return the system name or "computer" if the system name cannot be determined. |
Boolean |
isPublished()
Get the state of the service. |
String |
key()
Get the key of the ZeroConfService object. |
protected static String |
key(String type,
String name)
Generate a ZeroConfService key for searching in the HashMap of running services. |
String |
name()
Get the name of the ZeroConfService object. |
void |
publish()
Start advertising the service. |
javax.jmdns.ServiceInfo |
serviceInfo()
Get the ServiceInfo property of the object. |
void |
stop()
Stop advertising the service. |
static void |
stopAll()
Stop advertising all services. |
String |
type()
Get the type of the ZeroConfService object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ZeroConfService(javax.jmdns.ServiceInfo service)
service - | Method Detail |
|---|
public static ZeroConfService create(String type,
int port)
create(type, port, props)with an empty props HashMap.
type - port -
public static ZeroConfService create(String type,
int port,
HashMap<String,String> props)
createwith the default weight and priority, and with the name "hostName" with dots and dashes replaced with spaces.
type - port - props -
public static ZeroConfService create(String type,
String name,
int port,
int weight,
int priority,
HashMap<String,String> props)
name - type - port - weight - priority - props - public String key()
protected static String key(String type,
String name)
type - name - public String name()
public String type()
public javax.jmdns.ServiceInfo serviceInfo()
public Boolean isPublished()
public void publish()
public void stop()
public static void stopAll()
public Collection<ZeroConfService> allServices()
public static String hostName()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||