org.fourthline.cling.model
Class Namespace

java.lang.Object
  extended by org.fourthline.cling.model.Namespace

public class Namespace
extends Object

Enforces path conventions for all locally offered resources (descriptors, icons, etc.)

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 Resources given a Device's metadata. This procedure is typically invoked once, when the device is added to the Registry.

Author:
Christian Bauer

Field Summary
protected  URI basePath
           
static String CALLBACK_FILE
           
static String CONTROL
           
static String DESCRIPTOR_FILE
           
static String DEVICE
           
static String EVENTS
           
static String SERVICE
           
 
Constructor Summary
Namespace()
           
Namespace(String basePath)
           
Namespace(URI basePath)
           
 
Method Summary
 URI getBasePath()
           
 URI getControlPath(Service service)
           
 URI getDescriptorPath(Device device)
           
 URI getDescriptorPath(Service service)
           
 URI getEventCallbackPath(Service service)
           
 URI getEventSubscriptionPath(Service service)
           
 URI getIconPath(Icon icon)
           
 URI getPath(Device device)
           
 URI getPath(Service service)
           
 Resource[] getResources(Device device)
           
 boolean isControlPath(URI uri)
           
 boolean isEventCallbackPath(URI uri)
           
 boolean isEventSubscriptionPath(URI uri)
           
 URI prefixIfRelative(Device device, URI uri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEVICE

public static final String DEVICE
See Also:
Constant Field Values

SERVICE

public static final String SERVICE
See Also:
Constant Field Values

CONTROL

public static final String CONTROL
See Also:
Constant Field Values

EVENTS

public static final String EVENTS
See Also:
Constant Field Values

DESCRIPTOR_FILE

public static final String DESCRIPTOR_FILE
See Also:
Constant Field Values

CALLBACK_FILE

public static final String CALLBACK_FILE
See Also:
Constant Field Values

basePath

protected final URI basePath
Constructor Detail

Namespace

public Namespace()

Namespace

public Namespace(String basePath)

Namespace

public Namespace(URI basePath)
Method Detail

getBasePath

public URI getBasePath()

getPath

public URI getPath(Device device)

getPath

public URI getPath(Service service)

getDescriptorPath

public URI getDescriptorPath(Device device)

getDescriptorPath

public URI getDescriptorPath(Service service)

getControlPath

public URI getControlPath(Service service)

getIconPath

public URI getIconPath(Icon icon)

getEventSubscriptionPath

public URI getEventSubscriptionPath(Service service)

getEventCallbackPath

public URI getEventCallbackPath(Service service)

prefixIfRelative

public URI prefixIfRelative(Device device,
                            URI uri)

isControlPath

public boolean isControlPath(URI uri)

isEventSubscriptionPath

public boolean isEventSubscriptionPath(URI uri)

isEventCallbackPath

public boolean isEventCallbackPath(URI uri)

getResources

public Resource[] getResources(Device device)
                        throws ValidationException
Throws:
ValidationException


Copyright © 2013 4th Line GmbH, Switzerland. All Rights Reserved.