public class Namespace extends Object
Every descriptor, icon, event callback, or action message is send to a URL. This namespace defines how the path of this URL will look like and it will build the path for a given resource.
By default, the namespace is organized as follows:
http://host:port/dev/<udn>/desc.xml
http://host:port/dev/<udn>/svc/<svcIdNamespace>/<svcId>/desc.xml
http://host:port/dev/<udn>/svc/<svcIdNamespace>/<svcId>/action
http://host:port/dev/<udn>/svc/<svcIdNamespace>/<svcId>/event
http://host:port/dev/<ThisIsEitherRootUDN>/svc/<svcIdNamespace>/<svcId>/event/cb.xml
http://host:port/dev/<OrEvenAnEmbeddedDevicesUDN>/svc/<svcIdNamespace>/<svcId>/action
...
The namespace is also used to discover and create all Resource
s
given a Device
's metadata. This procedure is typically
invoked once, when the device is added to the Registry
.
Modifier and Type | Field and Description |
---|---|
protected URI |
basePath |
static String |
CALLBACK_FILE |
static String |
CONTROL |
protected String |
decodedPath |
static String |
DESCRIPTOR_FILE |
static String |
DEVICE |
static String |
EVENTS |
static String |
SERVICE |
Constructor and Description |
---|
Namespace() |
Namespace(String basePath) |
Namespace(URI basePath) |
Modifier and Type | Method and Description |
---|---|
protected URI |
appendPathToBaseURI(String path) |
URI |
getBasePath() |
URI |
getControlPath(Service service) |
URI |
getDescriptorPath(Device device) |
URI |
getDescriptorPath(Service service) |
String |
getDescriptorPathString(Device device)
Performance optimization, avoids URI manipulation.
|
protected String |
getDevicePath(Device device) |
URI |
getEventCallbackPath(Service service) |
String |
getEventCallbackPathString(Service service)
Performance optimization, avoids URI manipulation.
|
URI |
getEventSubscriptionPath(Service service) |
URI |
getIconPath(Icon icon) |
URI |
getPath(Device device) |
URI |
getPath(Service service) |
Resource[] |
getResources(Device device) |
protected String |
getServicePath(Service service) |
boolean |
isControlPath(URI uri) |
boolean |
isEventCallbackPath(URI uri) |
boolean |
isEventSubscriptionPath(URI uri) |
URI |
prefixIfRelative(Device device,
URI uri) |
public static final String DEVICE
public static final String SERVICE
public static final String CONTROL
public static final String EVENTS
public static final String DESCRIPTOR_FILE
public static final String CALLBACK_FILE
protected final URI basePath
protected final String decodedPath
public Namespace()
public Namespace(String basePath)
public Namespace(URI basePath)
public URI getBasePath()
public String getDescriptorPathString(Device device)
public String getEventCallbackPathString(Service service)
public boolean isControlPath(URI uri)
public boolean isEventSubscriptionPath(URI uri)
public boolean isEventCallbackPath(URI uri)
public Resource[] getResources(Device device) throws ValidationException
ValidationException
Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.