You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-new/eclipse_lyo/setup-an-oslc-provider-consumer-application.md
+23-23Lines changed: 23 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,10 @@ equally valid for any other development environment.
7
7
8
8
## An alternative to the manual steps below
9
9
10
-
An alternative to the instructions on this page is to instead use [Lyo Designer](./lyo-designer.md) to quickly generate the project, including a very basic code skeleton. The generated project will also include the neccessary setup for OpenApi/Swagger support, TRS, etc.
10
+
An alternative to the instructions on this page is to instead use [Lyo Designer](./lyo-designer.md) to quickly generate the project, including a very basic code skeleton. The generated project will also include the necessary setup for OpenApi/Swagger support, TRS, etc.
11
11
12
-
1. Make sure your environment is setup for Lyo development as instructed on [Eclipse Setup for Lyo-based Development](./eclipse-setup-for-lyo-based-development.md)
1. Make sure your environment is set up for Lyo development as instructed on [Eclipse Setup for Lyo-based Development](./eclipse-setup-for-lyo-based-development.md)
1. Follow the [Create a Modelling Project](./toolchain-modelling-workshop.md#create-modelling-project) instructions (*Only this particular section*) to create the Eclipse project.
15
15
1. Follow the [Adapter Interface](./toolchain-modelling-workshop.md#adaptor-interface-view) instructions (*Only this particular section*) to create a single Adaptor Interface in the model. You do not need to create any additional elements, such as a Service Provider Catalog, Service Provider, etc. Just make sure you set the generation settings as expected.
16
16
1. Follow the [Generate Lyo Java code](./toolchain-modelling-workshop.md#generate-oslc4j-java-code) instructions (*Only this particular section*) to generate your basic project setup.
@@ -34,7 +34,7 @@ As a complement when following the instructions below, you can find sample proje
34
34
35
35
Creating the project consists of these steps:
36
36
37
-
1.[Setup Eclipse](#set-up-eclipse)
37
+
1.[Set up Eclipse](#set-up-eclipse)
38
38
1.[Decide if you want to adopt JAX-RS 1.0 or 2.0?](#decide-jaxrs)
39
39
1.[Create a Maven project](#create-maven-project)
40
40
1.[Customise the project POM file](#customize-project-pom-file)
@@ -45,14 +45,14 @@ Creating the project consists of these steps:
45
45
46
46
## Set up Eclipse
47
47
48
-
Make sure your environment is setup for Lyo development as instructed on [Eclipse Setup for Lyo-based Development](./eclipse-setup-for-lyo-based-development.md)
48
+
Make sure your environment is set up for Lyo development as instructed on [Eclipse Setup for Lyo-based Development](./eclipse-setup-for-lyo-based-development.md)
49
49
50
50
## Create a Maven project
51
51
52
-
To create a Maven project from an archetype via Eclipse
52
+
To create a Maven project from an archetype via Eclipse:
53
53
54
-
1.select*File -> New -> Other*
55
-
1.then select *Maven Project* under *Maven* group.
54
+
1.Select*File -> New -> Other*
55
+
1.Then select *Maven Project* under *Maven* group.
56
56
1. Leave the *Create a simple project* checkbox unchecked.
57
57
1. Uncheck the *Use default Workspace location* option and point it to the project root
58
58
1. Press *Next*
@@ -63,7 +63,7 @@ Next, select the `maven-archetype-webapp` archetype:
63
63
64
64

65
65
66
-
Next, Fill in the **Group Id**, **Artefact Id**, and the **Package Base**.
66
+
Next, fill in the **Group Id**, **Artefact Id**, and the **Package Base**.
67
67
68
68
* The **Package Base** value (`com.sample.adaptor` on this page) will be used as a base package for your server code.
69
69
@@ -77,7 +77,7 @@ You should now have the project in Eclipse and the following folder structure:
77
77
78
78
We now need to modify the project *pom.xml* file.
79
79
80
-
### Setup general POM properties
80
+
### Set up general POM properties
81
81
82
82
We will also use properties to define a common version for Lyo packages:
83
83
@@ -93,7 +93,7 @@ We will also use properties to define a common version for Lyo packages:
93
93
94
94
### (Optional) Add Lyo repositories
95
95
96
-
Lyo release artifacts are on Maven central since 4.0.0 - no action needed from your side.
96
+
Lyo release artefacts are on Maven central since 4.0.0 - no action needed from your side.
97
97
98
98
If you wish to use the latest development snapshots, you will need the following entry:
99
99
@@ -151,7 +151,7 @@ Lyo depends on JAX-RS APIs and your application needs to add implementations of
151
151
152
152
#### For Lyo 5.x
153
153
154
-
For Lyo release 5.0.0 and above, you will need to choose a JAX-RS 2.0 implementation. If you are using Jersey, you should use version 2.35. *Note that starting with Jersey 2.26, HK2 is not bundled with the core artifacts (see the [Jersey migration guide](https://eclipse-ee4j.github.io/jersey.github.io/documentation/2.35/user-guide.html#mig-2.26)).*
154
+
For Lyo release 5.0.0 and above, you will need to choose a JAX-RS 2.0 implementation. If you are using Jersey, you should use version 2.35. *Note that starting with Jersey 2.26, HK2 is not bundled with the core artefacts (see the [Jersey migration guide](https://eclipse-ee4j.github.io/jersey.github.io/documentation/2.35/user-guide.html#mig-2.26)).*
155
155
```xml
156
156
<dependency>
157
157
<groupId>org.glassfish.jersey.core</groupId>
@@ -215,7 +215,7 @@ If your server needs to support OAuth, include the following:
215
215
</dependency>
216
216
```
217
217
218
-
To support OAuth, you will need to add the following JAX-RS Providers to your Application (the `javax.ws.rs.core.Application` subclass)
218
+
To support OAuth, you will need to add the following JAX-RS Providers to your Application (the `javax.ws.rs.core.Application` subclass):
@@ -316,7 +316,7 @@ Modify the parameters in `/src/main/webapp/WEB-INF/web.xml` according to the tem
316
316
317
317
With OSLC being based on REST, an OSLC Server can relatively easily be documented using [OpenApi/Swagger](https://swagger.io/).
318
318
319
-
The instructions below are based on [Swagger Core JAX RS Project Setup 1.5.X](https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-JAX-RS-Project-Setup-1.5.X), compiled for a typical Lyo project. The instructions are also partially base on
319
+
The instructions below are based on [Swagger Core JAX RS Project Setup 1.5.X](https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-JAX-RS-Project-Setup-1.5.X), compiled for a typical Lyo project. The instructions are also partially based on
320
320
[Co-hosting Swagger UI with your Jersey REST API using Maven dependencies](https://medium.com/shark-bytes/co-hosting-swagger-ui-with-your-jersey-rest-api-using-maven-dependencies-44d88ae85bf8). The instructions provide the minimal settings necessary for a Lyo project.
321
321
322
322
### Add OpenApi/Swagger Maven dependencies
@@ -449,7 +449,7 @@ The OpenApi documentation can be achieved with as little as adding `@Api` to eac
449
449
450
450
#### `@Api`
451
451
452
-
1. For each REST service (ie. OSLC Service), simply add the `@Api` annotation.
452
+
1. For each REST service (i.e. OSLC Service), simply add the `@Api` annotation.
453
453
1. (*OPTIONAL*) add the *value* and *description* details. The *value* is used to group the REST methods into common categories, helping in the structuring of the methods in the documentation. You can give it the same value as that of the @Path annotation, collecting all REST methods for the same service together.
454
454
455
455
```java
@@ -466,7 +466,7 @@ For each REST method, add the `@ApiOperation` Swagger annotation.
466
466
In [OpenApi](https://swagger.io/docs/specification/paths-and-operations/), an operation is considered unique based on the combination of its path and HTTP method. This means you cannot define multiple C.R.U.D. methods for the same path and method—even if they differ by parameters such as `Accept` or `Content-Type`.
467
467
468
468
!!! example
469
-
If your OSLC Service defines separate Java methods to handle HTML and RDF/XML content types for the same path and HTTP method, OpenApi will only recognize one of these methods and ignore the other.
469
+
If your OSLC Service defines separate Java methods to handle HTML and RDF/XML content types for the same path and HTTP method, OpenApi will only recognise one of these methods and ignore the other.
470
470
471
471
**Workaround:** Annotate ALL methods that are identified as unique with the complete list of media types in the *produces* property of the `@ApiOperation` annotation. This way, the generated documentation correctly indicates the existence of all methods.
472
472
@@ -484,7 +484,7 @@ For each REST method, add the `@ApiOperation` Swagger annotation.
484
484
For each Java class that models an OSLC-resource (`@OslcName` annotation), add an `@ApiModel` annotation that refers to the Shape of the resource, since a Shape is a more accurate description of the object, than the one automatically generated by Swagger.
485
485
486
486
```java
487
-
@ApiModel(description = "The model below is only a object structure as derived by swagger. For a more accurate RDF Description, refer to the Requirement Resource Shape.")
487
+
@ApiModel(description = "The model below is only an object structure as derived by swagger. For a more accurate RDF Description, refer to the Requirement Resource Shape.")
@@ -525,9 +525,9 @@ Add a dependency for the TRS Server library:
525
525
</dependency>
526
526
527
527
528
-
### Setup the TRS JAX-RS Provider to your Application
528
+
### Set up the TRS JAX-RS Provider to your Application
529
529
530
-
The *TRS Server* library already contains a `TrackedResourceSetService` class that can handle the REST calls for TRS Base and ChangeLog. For this service to work, you will only need to provide a binding to a singleton of a class that implements the `PagedTrs` class.
530
+
The *TRS Server* library already contains a `TrackedResourceSetService` class that can handle the REST calls for TRS Base and ChangeLog. For this service to work, you will only need to provide a binding to a singleton of a class that implements the `PagedTrs` class.
531
531
532
532
Register the TRS JAX-RS Provider `TrackedResourceSetService` in your Application (the `javax.ws.rs.core.Application` subclass).
533
533
@@ -545,7 +545,7 @@ public class Application extends javax.ws.rs.core.Application {
545
545
...
546
546
```
547
547
548
-
Provide the necessary binding definition for the `PagedTrs` class.
548
+
Provide the necessary binding definition for the `PagedTrs` class.
549
549
550
550
```java
551
551
import java.util.Collections;
@@ -566,8 +566,8 @@ public class Application extends javax.ws.rs.core.Application {
566
566
}
567
567
```
568
568
569
-
Define the `InmemPagedTrsSingleton` singleton class. You will need to complete the code example below, with
570
-
* the code that populates `uris` with the intial set of resources to be managed by `InmemPagedTrs`.
569
+
Define the `InmemPagedTrsSingleton` singleton class. You will need to complete the code example below, with:
570
+
* the code that populates `uris` with the initial set of resources to be managed by `InmemPagedTrs`;
571
571
* the desired `basePageLimit` and `changelogPageLimit` parameters.
572
572
573
573
```java
@@ -606,7 +606,7 @@ public class InmemPagedTrsSingleton implements Factory<PagedTrs> {
606
606
607
607
ArrayList<URI> uris = new ArrayList<URI>();
608
608
609
-
//TODO: populate uris with the intial set of resources to be managed by the InmemPagedTrs instance
609
+
//TODO: populate uris with the initial set of resources to be managed by the InmemPagedTrs instance
610
610
....
611
611
// not thread-safe
612
612
inmemPagedTrs = new InmemPagedTrs(<basePageLimit>, <changelogPageLimit>,
0 commit comments