From PmWiki

Resources: Using the RD

Resource Directory (RD)


In the Smart Santander system one of the main RD’s tasks is persistent storage of resources available in the system. Resources are described using human/machine readable resource description format. During system bootstrapping, the system topology of a testbed is initialized based on the information from the RD. Whenever the topology changes afterwards, the RD is updated accordingly. Up to date system resources management is provided through the REST based RD interfaces.

RD manages resource “create/update” fields as well as appropriate querying of these fields. This feature facilitates component bootstrapping/restarting. Existing query interface is extended for create/update fields, their values may be specified inthe ‘yyyy-MM-dd HH:mm:ss’ time format or milliseconds since 1.1.1970.

Template based matching in the query interface is introduced. This querying is based on the regular expression usage. Currently template based querying is part of the existing query interface, but this will be moved to the additional querying interface.

Some fields of the resource description are interpreted as a numeric values, which provides a better querying capabilities. This enhancement for example enables location based resource querying like: ..longitude>0. For appropriate TMON integration, several resource fields needs to be interpreted as a values, like device radio power etc.

RD is based on the free form tree based resource description structure. Resource description model is shown on the following figure.

Resource description data model

Resource description example:

		<created>2013-07-03 15:21:58</created>
		<updated>2013-07-03 15:21:58</updated>

Parts of the resource description like uid, created, updated are managed by the RD and thus can't be updated by end user.

Querying is performed for elements value in the following format: <RD_HOST>/rli?path=value. Path is relative to the root element dot separated. For example if we need resources with type OUTDOOR qurey is: <RD_HOST>/rli?position.type=OUTDOOR

For easier usage Java RD API library is built. Methods in the RD API are from generic CRUD to the component specific methods like “enable/disable node” etc.

Sample Java RD API library usage:

                RD_API_HTTP rdApi = new RD_API_HTTP(RD_URL);

		// list resources
		List<RDResource> resources = rdApi.getRDResources();

		// a new resource creation
		RDResource res = new RDResource();

		RDNode descr = new RDNode(RDNodeValueType.Container, "sensor", null)
			.addChild(new RDNode(RDNodeValueType.String, "type", "temperature"))
			.addChild(new RDNode(RDNodeValueType.String, "unit", "celsius"));


		// resource publishing

		// resource updating
		rdApi. updateResource(newResource, uid);

		// resource deleting

		// resource querying
		List<RDResource> resLookup = rdApi.lookupRD("sensor.type=Temperature");
Retrieved from
Page last modified on July 23, 2013, at 11:44 AM