Home

Awesome

OSLC 2020 Reference Implementation

CI build Discourse users Gitpod ready-to-code

Introduction

Reference implementation of four OSLC Servers covering each of the 4 OSLC Domains:

How to run

Follow the 3 sections below to:

  1. Run the OSLC Servers
  2. Populate with sample data
  3. Navigate to OSLC servers

Run the OSLC Servers

There are multiple options to run the OSLC Server.

Using built-in servers directly

This is the simplest option if you don't want to use anything except JDK and a Maven installation. Prerequisites:

Follow these steps to start 4 servers:

cd src/
mvn clean install
# if you have Docker running, you can run integration and acceptance tests
# mvn clean verify -Pacceptance

cd server-rm/
mvn clean jetty:run-war

cd ../server-cm/
mvn clean jetty:run-war

cd ../server-qm/
mvn clean jetty:run-war

cd ../server-am/
mvn clean jetty:run-war

After following these steps, proceed to the steps listed in the next section Navigating OSLC servers.

Using Jetty-based containers with Docker

If you wish to run 4 OSLC servers as 4 containers similar to how one would deploy them in the cloud, you could follow steps listed in this subsection. Prerequisites:

Docker Compose setup was also tested with Rancher Desktop 1.0.1.

cd src/
mvn clean install

# Using Docker Compose
docker compose up --build

# or, only using Docker
cd server-rm/
mvn clean package
docker build -t refimpl-server-rm .
docker run -d --name=oslc-refimpl-rm --rm -p 8800:8080 refimpl-server-rm

cd ../server-cm/
mvn clean package
docker build -t refimpl-server-cm .
docker run -d --name=oslc-refimpl-cm --rm -p 8801:8080 refimpl-server-cm

cd ../server-qm/
mvn clean package
docker build -t refimpl-server-qm .
docker run -d --name=oslc-refimpl-qm --rm -p 8802:8080 refimpl-server-qm

cd ../server-am/
mvn clean package
docker build -t refimpl-server-am .
docker run -d --name=oslc-refimpl-am --rm  -p 8803:8080 refimpl-server-am
cd ..

Make sure all is up and running:

$ docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS          PORTS                    NAMES
7a719e58b909   refimpl-server-am   "/docker-entrypoint.…"   2 seconds ago    Up 1 second     0.0.0.0:8803->8080/tcp   oslc-refimpl-am
ea678fe26dbe   refimpl-server-qm   "/docker-entrypoint.…"   10 seconds ago   Up 10 seconds   0.0.0.0:8802->8080/tcp   oslc-refimpl-qm
e7cdcb427f78   refimpl-server-cm   "/docker-entrypoint.…"   19 seconds ago   Up 18 seconds   0.0.0.0:8801->8080/tcp   oslc-refimpl-cm
37b905ccc0a0   refimpl-server-rm   "/docker-entrypoint.…"   28 seconds ago   Up 27 seconds   0.0.0.0:8800->8080/tcp   oslc-refimpl-rm

After following these steps, proceed to the steps listed in the next section Navigating OSLC servers.

To see logs:

docker logs oslc-refimpl-am -f

To stop:

docker stop oslc-refimpl-am
docker stop oslc-refimpl-cm
docker stop oslc-refimpl-rm
docker stop oslc-refimpl-qm

Running on Tomcat in Docker

cd src/
mvn clean install

cd server-rm/
mvn clean package -Pwith-jstl-impl
docker build -f tomcat.Dockerfile -t refimpl-server-rm .
docker run -p 8800:8080 refimpl-server-rm

Running on Tomcat via Maven

cd src/
mvn clean install
# if you have Docker running, you can run integration and acceptance tests
# mvn clean verify -Pacceptance

cd server-rm/
mvn clean package cargo:run -D"cargo.maven.containerId=tomcat10x" -Pwith-jstl-impl

cd ../server-cm/
mvn clean package cargo:run -D"cargo.maven.containerId=tomcat10x" -Pwith-jstl-impl

cd ../server-qm/
mvn clean package cargo:run -D"cargo.maven.containerId=tomcat10x" -Pwith-jstl-impl

cd ../server-am/
mvn clean package cargo:run -D"cargo.maven.containerId=tomcat10x" -Pwith-jstl-impl

Populate with sample data

Once running, you can populate the reference implementation servers with some OSLC resources using one of these 2 alternatives:

Parameters:

  1. Use --help to see all accepted arguments.
  2. If you omit the argument, all 4 servers will be initialized.
  3. You can initialize one or more servers with - for example - --init-servers am,qm.

Navigate to OSLC servers

After that, OSLC servers are available at the following URLs:

Currently, OAuth 1.0 with Basic fallback is enabled only on the OSLC RM server (port 8800). Use admin:admin credentials for Basic authentication. In order to enable OAuth support on other servers, uncomment the following lines under src/main/webapp/WEB-INF/web.xml of each server:

<filter>
    <display-name>CredentialsFilter</display-name>
    <filter-name>CredentialsFilter</filter-name>
    <filter-class>co.oslc.refimpl.rm.gen.servlet.CredentialsFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>CredentialsFilter</filter-name>
    <url-pattern>/services/*</url-pattern>
</filter-mapping>

Swagger endpoints are available at the following URIs (use sp_single as a serviceProviderId where required):

Root Services for the RM Server is under: http://localhost:8800/services/rootservices (similar for other servers).

License

The Reference Implementation code and Lyo Designer model are licensed under the Apache License v2.0. See the LICENSE file for the full text of the license.