Interface ServiceLayer


@ProviderType public interface ServiceLayer
Primary Interface for an oneM2M application entity to send request and get response to/from other oneM2M entity.

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 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

      Promise<ResourceDTO> create(String uri, ResourceDTO resource)
      create resource

      The 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

      Promise<ResourceDTO> retrieve(String uri)
      retrieve resource

      retrieve 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

      Promise<ResourceDTO> retrieve(String uri, List<String> targetAttributes)
      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 resource
      targetAttributes - names of the target attribute
      Returns:
      retrieved resource data
    • update

      Promise<ResourceDTO> update(String uri, ResourceDTO resource)
      update resource

      The 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 resource
      resource - data resource
      Returns:
      updated resource
    • delete

      Promise<Boolean> delete(String uri)
      delete resource

      delete resource on the URI specified by uri argument.

      Parameters:
      uri - target URI for deleting resource
      Returns:
      promise of execution status
    • discovery

      Promise<List<String>> discovery(String uri, FilterCriteriaDTO fc)
      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 search
      fc - filter criteria selecting resources
      Returns:
      list of URIs matching the condition specified in fc
    • discovery

      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 search
      fc - filter criteria
      drt - Discovery Result Type (structured/unstructured)
      Returns:
      list of URIs matching the condition specified in fc
    • notify

      Promise<Boolean> notify(String uri, NotificationDTO notification)
      send notification

      Parameters:
      uri - uri of destination
      notification - content of notification
      Returns:
      Promise of notification execution status