Interface ServiceLayer
It contains low level API and high level API. The only low level method is request() and other methods are categorized as high level API.
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(String uri, ResourceDTO resource) create resourcedelete resourcediscovery
(String uri, FilterCriteriaDTO fc) find resources with filter condition specified in fc argument.find resources with filter condition specified in fc argument.notify
(String uri, NotificationDTO notification) send notificationrequest
(RequestPrimitiveDTO request) send a request and receive response.retrieve resourceretrieve resource with selected attributes.update
(String uri, ResourceDTO resource) update resource
-
Method Details
-
request
send a request and receive response.This method allows very raw data type access and it enables all possible message exchanges among oneM2M entities. This is called the low level API. This method allows all possible operation of oneM2M. For the return type, OSGi Promise is used for allowing synchronous and asynchronous calling manner.
- Parameters:
request
- request primitive- Returns:
- promise of ResponseDTO.
-
create
create resourceThe create() method is a method to create new resource under specified uri. The second argument resource is expression of resource to be generated. The resourceType field of the resourceDTO must be assigned. For other fields depends on resource type. Section 7.4 of TS-00004 specifies the optionalities of the fields.
- Parameters:
uri
- URI for parent resource of the resource being created.resource
- resource data- Returns:
- Promise of created resource
-
retrieve
retrieve resourceretrieve resource on URI specified by uri argument. This method retrieve all attributes of the resource.
- Parameters:
uri
- URI for retrieving resource- Returns:
- retrieved resource data
-
retrieve
retrieve resource with selected attributes.retrieve resource on URI specified by uri argument. This method retrieve selected attributes by targetAttributes argument. The retrieve() methods are methods to retrieve resource on URI specified by uri argument.
- Parameters:
uri
- URI for retrieving resourcetargetAttributes
- names of the target attribute- Returns:
- retrieved resource data
-
update
update resourceThe update() method is a method to update resource on the URI specified by uri argument. The resource argument holds attributes to be updated. Attributes not to be updated shall not included in the argument.
- Parameters:
uri
- URI for updating resourceresource
- data resource- Returns:
- updated resource
-
delete
delete resourcedelete resource on the URI specified by uri argument.
- Parameters:
uri
- target URI for deleting resource- Returns:
- promise of execution status
-
discovery
find resources with filter condition specified in fc argument.Discovery Result Type is kept as blank and default value of target CSE is used for the parameter.
- Parameters:
uri
- URI for resource tree to start the searchfc
- filter criteria selecting resources- Returns:
- list of URIs matching the condition specified in fc
-
discovery
Promise<List<String>> discovery(String uri, FilterCriteriaDTO fc, RequestPrimitiveDTO.DesiredIdentifierResultType drt) find resources with filter condition specified in fc argument.With this method application can specify desired identifier in result
- Parameters:
uri
- URI for resource tree to start the searchfc
- filter criteriadrt
- Discovery Result Type (structured/unstructured)- Returns:
- list of URIs matching the condition specified in fc
-
notify
send notification- Parameters:
uri
- uri of destinationnotification
- content of notification- Returns:
- Promise of notification execution status
-