【 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 called resources, while in SOA, they are called services. This article provides 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, transport-independent architecture. The Resource-Oriented Architecture (ROA) paradigm is built on the concept of resources. A resource is an independent, identifiable entity whose state can be assigned a uniform resource locator (URI). Services represent the execution of requested operations, while resources represent distributed components that can be managed through a consistent standardized interface. One of the characteristics of a resource-oriented architecture is transport agnostic. Therefore, there must be a specific mechanism for exposing resource-oriented services to the outside world. When a consumer requests a Uniform Resource Locator (URL) and specifies access methods (for example, GET, PUT, POST, and DELETE), the URL is converted to a relative internal URI. Access methods are translated into actions. The resource-oriented architecture is modeled around only four concepts:

  • resources
  • URI
  • describe
  • Links and connectivity

Here are four attributes of a resource-oriented architecture:

  • addressable
  • statelessness
  • connectivity
  • Unified interface

Resource-oriented architecture: Resources

Resources are the cornerstone of ROA; Resources are logical representations of information. For example, a student is an abstract collection of data points that can be represented in a variety of ways, including XHTML, JSON, and XML. Resource names include the following:

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

Resources are the most important information abstraction in REST or RESTful architectures. The term “resource” refers to any identifiable information. This information can be documents, computers, cars, temporary services (such as “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
  • There must be at least one statement
  • With properties, schemas can be accessed and provide context

Uniform Resource Identifier (URI)

A Uniform Resource Identifier (URI) is a sequence of characters that contains the name and address of a Resource and is used to identify a logical or physical Resource. Note that the resource must have one or more URIs. Without a URI, a piece of information 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:

  • Action relative to URI destination
  • Read /student/3 Reads the student record with ID 3
  • Delete /student/4 Delete the student record whose ID is 4

Features of resource-oriented architecture ROA

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

addressable

Addressability is an essential feature of resource-oriented architecture. An application is 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. Because resources in the ROA are exposed using URIs, applications should expose their data using URIs.

stateless

Stateless is another characteristic of a resource-oriented architecture, meaning that each HTTP request in the architecture occurs independently. In other words, when a client requests a resource from a server, the client must provide all the information the server needs for the request to succeed. The server never stores information from previous requests, that is, no status 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 a resource-oriented architecture, representations are hypermedia: documents that contain links to data and other resources. RESTful Web services follow the Hypermedia As the Engine Of Application State (HATEOS) principle. This is the principle that data formats affect the state of transitions in your application. Links to other resources are embedded in the response, but they may vary for the same resource based on its current state. One of the most important features of the web is its interconnectedness. That is, almost everything 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 its resources to each other and vice versa. When we choose the right representation for resources, we can implement 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

HEAD and OPTIONS HTTP methods

Here are two other important HTTP methods you should be aware of:

HTTP HEAD – a metadata representation for retrieving a resource

HTTP OPTIONS – Checks which HTTP methods are supported by a particular resource

conclusion

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