【 note 】 this article translation: the Overview of the Resource – Oriented Architectures (ROA) | Developer.com

Learn about resource-oriented architecture (ROA), its values, and best practices.

Service-Oriented Architecture (SOA) and Resource-Oriented Architecture (Resource-Oriented Architecture) ROA) is an architectural design pattern for implementing a robust, extensible distributed application architecture. A distributed architecture consists of components that are used over a network through well-defined interfaces. In ROA, these components are referred to as resources; in SOA, they are referred to as services. This article provided an overview of resource-oriented architecture.

What is Resource Oriented Architecture (ROA)?

Resource Oriented Architecture (ROA) is an architectural style that extends the REST architectural style and provides a broader, extensible, flexible, and transport-independent architecture. The resource-oriented architecture (ROA) paradigm is based on the concept of resources. A resource is an independent, identifiable entity whose state can be assigned to a uniform resource locator (URI). A service represents the execution of a requested operation, while a resource represents a distributed component that can be managed through a consistent, standardized interface. One of the characteristics of a resource-oriented architecture is that it is transport-neutral. Therefore, there must be specific mechanisms to expose resource-oriented services to the outside world. When a consumer requests a Uniform Resource Locator (URL) and specifies an access method (for example, GET, PUT, POST, and DELETE), the URL is converted to a relative internal URI. Accessing methods are translated into actions. Resource-oriented architecture is modeled around only four concepts:

  • resources
  • URI
  • describe
  • Links and connectivity

Here are the four attributes of a resource-oriented architecture:

  • addressable
  • statelessness
  • connectivity
  • Uniform interface

Resource-oriented architecture: Resources

Resources are the cornerstone of ROA; A resource is a logical representation of information. For example, students are abstract collections of data points that can be represented in a variety of ways, including XHTML, JSON, and XML. The resource name includes the following:

  • Type of resource
  • Resource identifier
  • The resource name of the parent element
  • The name of the API service

Resources are the most important information abstraction in a REST or RESTful architecture. The term “resource” refers to any identifiable information. This information can be documents, computers, cars, temporary services (such as “the weather in Ohio today”), collections of other resources, individuals, students, and so on. Each immutable resource representation can be identified by a relative Uniform Resource Indicator (URI), which may include connections to other resources as well as other immutable resources. Note that a resource can also have multiple URIs. Each resource should have the following characteristics:

  • Is the only
  • You have to have at least one statement
  • With properties, the schema can be accessed and provides context

Uniform Resource Identifier (URI)

A Uniform Resource Identifier (URI) is a sequence of characters containing the name and address of a Resource used to identify a logical or physical Resource. Note that the resource must have one or more URIs. Without a URI, a message is not considered a resource because it cannot be referenced or accessed. You can use URIs to identify anything, such as real-world objects, Web pages, books, and so on. The following is an example of a URI: grammar: : example: http://payroll/employee/1234 in the table below shows how to specify resource relative URI:

  • The action is relative to the URI destination
  • Read /student/3 Read /student/3
  • Delete from student/4 Delete from student/4

Features of Resource Oriented Architecture (ROA)

Here are the four basic attributes of a resource-oriented architecture:

addressable

Addressability is an essential feature of a resource-oriented architecture. An application can be considered addressable if it publishes interested aspects of its data set as service endpoints. These services can in turn be used to process the application’s data. Since resources in ROA are exposed using URIs, applications should expose their data using URIs.

stateless

Statelessness is another characteristic of a resource-oriented architecture, which means that each HTTP request in the architecture occurs independently. In other words, when a client requests a resource from the server, the client must provide all the information the server needs to make the request successful. The server never stores information from a previous request, that is, no state information is stored on the server. If the server needs information from an earlier request to process the request, the client must send that information again in another request.

connectivity

In resource-oriented architectures, representations are hypermedia: documents that contain links to data and other resources. RESTful Web services follow Hypermedia As the Engine Of Application State (HATEOS) principles. This is the principle that data format affects the state of transitions in an application. Links to other resources are embedded in the response, but for the same resource, they may differ depending on its current state. One of the most important characteristics of a network is its interconnectedness. That is, almost all information on the Internet is linked together by hyperlinks. Hyperlinks can be used to connect any resource accessible on the Internet to another resource. An application built on ROA should link all of its resources to each other and vice versa. When we choose the right representation for our resources, we can achieve connectivity in our applications.

Unified interface

You should have a well-defined set of methods for manipulating resources in your application. For example, HTTP provides the following common actions that you might normally need to perform in any application:

HTTP GET – Gets a resource

HTTP POST – Creates a new resource

HTTP PUT – Modifies an existing resource

HTTP Delete – Deletes an existing resource

The HEAD and OPTIONS HTTP methods

Here are two other important HTTP methods you should know:

HTTP HEAD – A metadata representation used to retrieve a resource

HTTP Options – Used to check which HTTP methods are supported for a particular resource

conclusion

Resource-oriented architecture is stateless and resource-centric. The URI is used to identify each resource. You can always have multiple copies of the same resource simultaneously on your computer. A resource can also have multiple URIs.