├── .github └── workflows │ └── maven.yml ├── .gitignore ├── README.md ├── adaptor-client ├── .classpath ├── .gitignore ├── .project ├── pom.xml ├── resourceShapes.ttl └── src │ └── main │ ├── java │ └── com │ │ └── sample │ │ └── client │ │ ├── ClientOnlyApplicationConstants.java │ │ ├── OslcMainApplication.java │ │ ├── clients │ │ └── GenericRequiredAdaptorClient.java │ │ └── resources │ │ ├── DctermsDomainConstants.java │ │ ├── IRequirement.java │ │ ├── ITestScript.java │ │ ├── Oslc_qmDomainConstants.java │ │ ├── Oslc_rmDomainConstants.java │ │ ├── Requirement.java │ │ ├── TestScript.java │ │ └── package-info.java │ └── webapp │ ├── WEB-INF │ └── web.xml │ └── com │ └── sample │ └── client │ ├── requirementtohtml.jsp │ └── testscripttohtml.jsp ├── adaptor-rm-webapp ├── .classpath ├── .gitignore ├── .project ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── sample │ │ └── rm │ │ ├── Backend.java │ │ ├── RMToolConstants.java │ │ ├── ResourcesFactory.java │ │ ├── RestDelegate.java │ │ ├── ServerConstants.java │ │ ├── ServiceProviderInfo.java │ │ ├── clients │ │ └── GenericRequiredAdaptorClient.java │ │ ├── resources │ │ ├── DctermsDomainConstants.java │ │ ├── FoafDomainConstants.java │ │ ├── IRequirement.java │ │ ├── Oslc_rmDomainConstants.java │ │ ├── Requirement.java │ │ └── package-info.java │ │ ├── services │ │ ├── RequService.java │ │ ├── ResourceShapeService.java │ │ ├── ServiceProviderCatalogService.java │ │ ├── ServiceProviderService.java │ │ └── ServiceProviderService1.java │ │ └── servlet │ │ ├── Application.java │ │ ├── ApplicationBinder.java │ │ ├── ServiceProviderCatalogSingleton.java │ │ ├── ServiceProvidersFactory.java │ │ └── ServletListener.java │ ├── resources │ └── simplelogger.properties │ └── webapp │ ├── WEB-INF │ ├── beans.xml │ ├── jboss-all.xml │ └── web.xml │ ├── com │ └── sample │ │ └── rm │ │ ├── creationdialogsampleclient.jsp │ │ ├── requirement.jsp │ │ ├── requirementcreator.jsp │ │ ├── requirementscollection.jsp │ │ ├── requirementtohtml.jsp │ │ ├── resourceshape.jsp │ │ ├── selectiondialog.jsp │ │ ├── selectiondialogsampleclient.jsp │ │ ├── serviceprovider.jsp │ │ ├── serviceprovidercatalog.jsp │ │ ├── uipreview.jsp │ │ └── viewresource.jsp │ ├── delegatedUI.js │ ├── index.jsp │ ├── static │ ├── css │ │ └── adaptor.css │ ├── dist │ │ └── oslc-ui │ │ │ ├── 3rdpartylicenses.txt │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ ├── main-es2015.js │ │ │ ├── main-es5.js │ │ │ ├── polyfills-es2015.js │ │ │ ├── polyfills-es5.js │ │ │ ├── runtime-es2015.js │ │ │ ├── runtime-es5.js │ │ │ └── styles.css │ └── js │ │ ├── delegated-ui-helper.js │ │ ├── delegated-ui.js │ │ └── ui-preview-helper.js │ └── swagger-ui │ └── index.jsp ├── adaptor-testing-webapp ├── .classpath ├── .gitignore ├── .project ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── sample │ │ └── testing │ │ ├── Backend.java │ │ ├── ResourcesFactory.java │ │ ├── RestDelegate.java │ │ ├── ServerConstants.java │ │ ├── ServiceProviderInfo.java │ │ ├── TestingToolConstants.java │ │ ├── clients │ │ └── RequirementsAdaptorClient.java │ │ ├── resources │ │ ├── DctermsDomainConstants.java │ │ ├── FoafDomainConstants.java │ │ ├── IRequirement.java │ │ ├── ITestScript.java │ │ ├── Oslc_qmDomainConstants.java │ │ ├── Oslc_rmDomainConstants.java │ │ ├── Requirement.java │ │ ├── TestScript.java │ │ └── package-info.java │ │ ├── services │ │ ├── ResourceShapeService.java │ │ ├── ServiceProviderCatalogService.java │ │ ├── ServiceProviderService.java │ │ ├── ServiceProviderService1.java │ │ └── TestScriptService.java │ │ └── servlet │ │ ├── Application.java │ │ ├── ApplicationBinder.java │ │ ├── ServiceProviderCatalogSingleton.java │ │ ├── ServiceProvidersFactory.java │ │ └── ServletListener.java │ ├── resources │ └── simplelogger.properties │ └── webapp │ ├── WEB-INF │ └── web.xml │ ├── com │ └── sample │ │ └── testing │ │ ├── creationdialogsampleclient.jsp │ │ ├── requirementtohtml.jsp │ │ ├── resourceshape.jsp │ │ ├── selectiondialogsampleclient.jsp │ │ ├── serviceprovider.jsp │ │ ├── serviceprovidercatalog.jsp │ │ ├── testscript.jsp │ │ ├── testscriptlargepreview.jsp │ │ ├── testscriptscollection.jsp │ │ ├── testscriptsmallpreview.jsp │ │ └── testscripttohtml.jsp │ ├── delegatedUI.js │ ├── index.jsp │ ├── static │ ├── css │ │ ├── adaptor.css │ │ └── bootstrap-4.0.0-beta.min.css │ └── js │ │ ├── bootstrap-4.0.0-beta.min.js │ │ ├── delegated-ui-helper.js │ │ ├── delegated-ui.js │ │ ├── jquery-3.2.1.min.js │ │ ├── popper-1.11.0.min.js │ │ ├── preview.js │ │ └── ui-preview-helper.js │ └── swagger-ui │ └── index.jsp ├── img ├── SpecificationDiagram.png └── ToolchainDiagram.png └── toolchain-model ├── .gitignore ├── .project ├── My.toolchain ├── Pics ├── LyoToolchainModel-AdaptorInterfaceDiagram.png ├── LyoToolchainModel-SpecificationDiagram-Original.png ├── LyoToolchainModel-SpecificationDiagram.png └── LyoToolchainModel-ToolchainDiagram.png ├── README.md ├── license ├── edl-v10.html ├── epl-v10.html └── notice.html └── representations.aird /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | name: 'CI' 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'main-*' 7 | pull_request: 8 | branches: 9 | - 'main-*' 10 | schedule: 11 | - cron: "30 4,20 * * 4,5,6" # catch SNAPSHOT breaking changes 12 | workflow_dispatch: 13 | 14 | jobs: 15 | build: 16 | runs-on: ubuntu-latest 17 | timeout-minutes: 15 18 | 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | jdk: ['11', '17', '21'] 23 | distribution: ['temurin'] 24 | experimental: [false] 25 | include: 26 | - jdk: '24' 27 | distribution: 'zulu' 28 | experimental: true 29 | - jdk: '25-ea' 30 | distribution: 'zulu' 31 | experimental: true 32 | continue-on-error: ${{ matrix.experimental }} 33 | steps: 34 | - uses: actions/checkout@v4 35 | 36 | - name: Set up JDK ${{ matrix.jdk }} 37 | uses: actions/setup-java@v4 38 | with: 39 | distribution: ${{ matrix.distribution }} 40 | java-version: ${{ matrix.jdk }} 41 | 42 | - name: 'Build RM Sample' 43 | run: | 44 | mvn -B clean verify --file adaptor-rm-webapp/pom.xml 45 | 46 | - name: 'Build :: Testing Sample' 47 | run: | 48 | mvn -B clean verify --file adaptor-testing-webapp/pom.xml 49 | 50 | - name: 'Build :: Sample Client' 51 | run: | 52 | mvn -B clean verify --file adaptor-testing-webapp/pom.xml 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.iml 3 | 4 | target/ 5 | bin/ 6 | 7 | *~ 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lyo-adaptor-sample-modelling 2 | 3 | [![](https://img.shields.io/badge/project-Eclipse%20Lyo-blue?color=418eeb)](https://github.com/eclipse/lyo) 4 | [![CI](https://github.com/OSLC/lyo-adaptor-sample-modelling/actions/workflows/maven.yml/badge.svg)](https://github.com/OSLC/lyo-adaptor-sample-modelling/actions/workflows/maven.yml) 5 | ![Discourse users](https://img.shields.io/discourse/users?color=28bd84&server=https%3A%2F%2Fforum.open-services.net%2F) 6 | 7 | > [!NOTE] 8 | > This repository is no longer actively developed. To see Eclipse Lyo in action, refer to https://github.com/oslc-op/refimpl 9 | 10 | This is the repository with the sources of the finished [Lyo Toolchain Modelling and Code Generation Workshop](https://wiki.eclipse.org/Lyo/ToolchainModellingAndCodeGenerationWorkshop). 11 | 12 | **Note**: If you want to work with the latest version of the Lyo SDK and Lyo Designer (that is, 4.0.0-SNAPSHOT, which uses JAX-RS2.0, instead of Wink), then please refer to the [4.0.0-snapshot branch](https://github.com/OSLC/lyo-adaptor-sample-modelling/tree/4.0.0-snapshot) 13 | 14 | The repository contains 15 | * **toolchain-model** - A Lyo Designer modelling project that models 2 communicating OSLC Servers, together with their relevant domain specifications. 16 | * **adaptor-rm-webapp** - an OSLC server that serves Requirement resources. See the project [Read Me](https://github.com/OSLC/lyo-adaptor-sample-modelling/tree/master/adaptor-rm-webapp) for instructions on how to run. 17 | * **adaptor-testing-webapp** - an OSLC server that serves TestScript resources, while consuming resources from the *adaptor-rm-webapp* server. See the project [Read Me](https://github.com/OSLC/lyo-adaptor-sample-modelling/tree/master/adaptor-testing-webapp) for instructions on how to run. 18 | 19 | ![Toolchain Model](img/ToolchainDiagram.png) 20 | 21 | ![Domain Specification Model](img/SpecificationDiagram.png) 22 | 23 | ## Prerequisites 24 | 25 | - JDK 11 LTS (or possibly newer, briefly tested up to JDK 15 MTS) 26 | - Maven 3.6.3 or newer (and Maven-related IDE tools if you are using an IDE to build) 27 | -------------------------------------------------------------------------------- /adaptor-client/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /adaptor-client/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /overlays/ 3 | /.settings/ 4 | -------------------------------------------------------------------------------- /adaptor-client/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | client-only-application 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.jdt.core.javanature 33 | org.eclipse.m2e.core.maven2Nature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | org.eclipse.wst.jsdt.core.jsNature 36 | 37 | 38 | -------------------------------------------------------------------------------- /adaptor-client/resourceShapes.ttl: -------------------------------------------------------------------------------- 1 | @prefix rdf: . 2 | @prefix dcterms: . 3 | @prefix rdfs: . 4 | @prefix oslc: . 5 | 6 | 7 | a oslc:ResourceShape ; 8 | oslc:describes ; 9 | oslc:property [ a oslc:Property ; 10 | oslc:name "title" ; 11 | oslc:occurs oslc:Exactly-one ; 12 | oslc:propertyDefinition dcterms:title ; 13 | oslc:readOnly false ; 14 | oslc:valueType ; 15 | dcterms:title "title"^^rdf:XMLLiteral 16 | ] ; 17 | oslc:property [ a oslc:Property ; 18 | oslc:name "identifier" ; 19 | oslc:occurs oslc:Exactly-one ; 20 | oslc:propertyDefinition dcterms:identifier ; 21 | oslc:readOnly false ; 22 | oslc:valueType ; 23 | dcterms:title "identifier"^^rdf:XMLLiteral 24 | ] ; 25 | oslc:property [ a oslc:Property ; 26 | oslc:name "description" ; 27 | oslc:occurs oslc:Exactly-one ; 28 | oslc:propertyDefinition dcterms:description ; 29 | oslc:readOnly false ; 30 | oslc:valueType ; 31 | dcterms:title "description"^^rdf:XMLLiteral 32 | ] ; 33 | dcterms:title "Requirement Resource Shape"^^rdf:XMLLiteral . 34 | 35 | 36 | a oslc:ResourceShape ; 37 | oslc:describes ; 38 | oslc:property [ a oslc:Property ; 39 | oslc:name "title" ; 40 | oslc:occurs oslc:Exactly-one ; 41 | oslc:propertyDefinition dcterms:title ; 42 | oslc:readOnly false ; 43 | oslc:valueType ; 44 | dcterms:title "title"^^rdf:XMLLiteral 45 | ] ; 46 | oslc:property [ a oslc:Property ; 47 | oslc:name "description" ; 48 | oslc:occurs oslc:Exactly-one ; 49 | oslc:propertyDefinition dcterms:description ; 50 | oslc:readOnly false ; 51 | oslc:valueType ; 52 | dcterms:title "description"^^rdf:XMLLiteral 53 | ] ; 54 | oslc:property [ a oslc:Property ; 55 | oslc:name "validatesRequirement" ; 56 | oslc:occurs oslc:Zero-or-many ; 57 | oslc:propertyDefinition ; 58 | oslc:range ; 59 | oslc:readOnly false ; 60 | oslc:representation oslc:Reference ; 61 | oslc:valueType oslc:Resource ; 62 | dcterms:title "validatesRequirement"^^rdf:XMLLiteral 63 | ] ; 64 | dcterms:title "TestScript Resource Shape"^^rdf:XMLLiteral . 65 | -------------------------------------------------------------------------------- /adaptor-client/src/main/java/com/sample/client/ClientOnlyApplicationConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.client; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | // Start of user code imports 31 | // End of user code 32 | 33 | public interface ClientOnlyApplicationConstants 34 | { 35 | // Start of user code user constants 36 | // End of user code 37 | 38 | public static final String HDR_OSLC_VERSION = "OSLC-Core-Version"; 39 | public static final String OSLC_VERSION_V2 = "2.0"; 40 | } 41 | -------------------------------------------------------------------------------- /adaptor-client/src/main/java/com/sample/client/OslcMainApplication.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2017 Jad El-khoury. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Jad El-khoury - initial implementation of main class for client-only adaptor 16 | * 17 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 18 | *******************************************************************************/ 19 | // End of user code 20 | 21 | package com.sample.client; 22 | 23 | import java.io.File; 24 | import java.io.FileOutputStream; 25 | import java.util.ArrayList; 26 | import java.util.List; 27 | import java.util.NoSuchElementException; 28 | import java.util.logging.Level; 29 | import java.util.logging.Logger; 30 | import java.net.MalformedURLException; 31 | 32 | import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; 33 | import org.eclipse.lyo.oslc4j.core.model.ResourceShape; 34 | import org.eclipse.lyo.oslc4j.core.model.ResourceShapeFactory; 35 | import org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog; 36 | import org.eclipse.lyo.oslc4j.provider.jena.JenaModelHelper; 37 | 38 | import org.apache.jena.rdf.model.Model; 39 | 40 | import com.sample.client.resources.Requirement; 41 | import com.sample.client.resources.TestScript; 42 | import com.sample.client.clients.GenericRequiredAdaptorClient; 43 | 44 | // Start of user code imports 45 | // End of user code 46 | 47 | // Start of user code pre_class_code 48 | // End of user code 49 | 50 | public class OslcMainApplication { 51 | 52 | private static String baseUrl = "http://localhost:8080"; 53 | private static String servletUrlPattern = "services/"; 54 | private static final Logger logger = Logger.getLogger(OslcMainApplication.class.getName()); 55 | 56 | // Start of user code class_attributes 57 | // End of user code 58 | 59 | // Start of user code class_methods 60 | // End of user code 61 | 62 | public static void main(String[] args) throws Exception 63 | { 64 | // Start of user code main 65 | //TODO: Replace/adjust this default main function as necessary. 66 | //All manual changes in this "protected" user code area will NOT be overwritten upon subsequent code generations. 67 | //To revert to the default generated content, delete all content in this file, and then re-generate. 68 | try { 69 | OSLC4JUtils.setPublicURI(baseUrl); 70 | OSLC4JUtils.setServletPath(servletUrlPattern); 71 | } catch (MalformedURLException e) { 72 | logger.log(Level.SEVERE, "Application encountered MalformedURLException.", e); 73 | } catch (IllegalArgumentException e) { 74 | logger.log(Level.SEVERE, "Application encountered IllegalArgumentException.", e); 75 | } 76 | 77 | ServiceProviderCatalog genericRequiredAdaptorClientCatalog = GenericRequiredAdaptorClient.getServiceProviderCatalog(); 78 | 79 | List shapes = new ArrayList(); 80 | shapes.add(Requirement.createResourceShape()); 81 | shapes.add(TestScript.createResourceShape()); 82 | Model model = JenaModelHelper.createJenaModel(shapes.toArray()); 83 | String fileName = "resourceShapes.ttl"; 84 | FileOutputStream output = new FileOutputStream(new File(fileName)); 85 | model.write(output, "TURTLE" ); 86 | } 87 | // End of user code 88 | } 89 | -------------------------------------------------------------------------------- /adaptor-client/src/main/java/com/sample/client/clients/GenericRequiredAdaptorClient.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2015 Jad El-khoury. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Jad El-khoury - initial implementation of client code 16 | * 17 | *******************************************************************************/ 18 | // End of user code 19 | 20 | package com.sample.client.clients; 21 | 22 | import javax.ws.rs.core.Response; 23 | import org.eclipse.lyo.client.OSLCConstants; 24 | import org.eclipse.lyo.client.OslcClient; 25 | import org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog; 26 | import com.sample.client.resources.Requirement; 27 | import com.sample.client.resources.TestScript; 28 | 29 | // Start of user code imports 30 | // End of user code 31 | 32 | 33 | // Start of user code pre_class_code 34 | // End of user code 35 | 36 | public class GenericRequiredAdaptorClient 37 | { 38 | 39 | // Start of user code class_attributes 40 | // End of user code 41 | 42 | // Start of user code class_methods 43 | // End of user code 44 | 45 | static String serviceProviderCatalogURI = "http://localhost:8083/adaptor-rm/services/catalog/singleton"; 46 | 47 | public static ServiceProviderCatalog getServiceProviderCatalog() throws Exception { 48 | OslcClient client = new OslcClient(); 49 | Response response = null; 50 | ServiceProviderCatalog catalog = null; 51 | 52 | // Start of user code getServiceProviderCatalog_init 53 | // End of user code 54 | 55 | response = client.getResource(serviceProviderCatalogURI,OSLCConstants.CT_RDF); 56 | if (response != null) { 57 | catalog = response.readEntity(ServiceProviderCatalog.class); 58 | } 59 | // Start of user code getServiceProviderCatalog_final 60 | // End of user code 61 | return catalog; 62 | } 63 | 64 | public static Requirement getRequirement(String resourceURI) throws Exception { 65 | OslcClient client = new OslcClient(); 66 | Response response = null; 67 | Requirement resource = null; 68 | 69 | // Start of user code getRequirement_init 70 | // End of user code 71 | 72 | response = client.getResource(resourceURI, OSLCConstants.CT_RDF); 73 | if (response != null) { 74 | resource = response.readEntity(Requirement.class); 75 | } 76 | // Start of user code getRequirement_final 77 | // End of user code 78 | return resource; 79 | } 80 | 81 | public static TestScript getTestScript(String resourceURI) throws Exception { 82 | OslcClient client = new OslcClient(); 83 | Response response = null; 84 | TestScript resource = null; 85 | 86 | // Start of user code getTestScript_init 87 | // End of user code 88 | 89 | response = client.getResource(resourceURI, OSLCConstants.CT_RDF); 90 | if (response != null) { 91 | resource = response.readEntity(TestScript.class); 92 | } 93 | // Start of user code getTestScript_final 94 | // End of user code 95 | return resource; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /adaptor-client/src/main/java/com/sample/client/resources/DctermsDomainConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.client.resources; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | 31 | // Start of user code imports 32 | // End of user code 33 | 34 | public interface DctermsDomainConstants 35 | { 36 | // Start of user code user constants 37 | // End of user code 38 | 39 | public static String DUBLIN_CORE_DOMAIN = "http://purl.org/dc/terms/"; 40 | public static String DUBLIN_CORE_NAMSPACE = "http://purl.org/dc/terms/"; 41 | public static String DUBLIN_CORE_NAMSPACE_PREFIX = "dcterms"; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /adaptor-client/src/main/java/com/sample/client/resources/IRequirement.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Sam Padgett - initial API and implementation 20 | * Michael Fiedler - adapted for OSLC4J 21 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 22 | * 23 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 24 | *******************************************************************************/ 25 | // End of user code 26 | 27 | package com.sample.client.resources; 28 | 29 | import java.net.URI; 30 | import java.net.URISyntaxException; 31 | import java.util.ArrayList; 32 | import java.util.Arrays; 33 | import java.util.Date; 34 | import java.util.HashMap; 35 | import java.util.Map; 36 | import java.text.SimpleDateFormat; 37 | import java.util.HashSet; 38 | import java.util.List; 39 | import java.util.Set; 40 | import java.util.TreeSet; 41 | import java.util.Iterator; 42 | 43 | import org.eclipse.lyo.oslc4j.core.annotation.OslcAllowedValue; 44 | import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription; 45 | import org.eclipse.lyo.oslc4j.core.annotation.OslcMemberProperty; 46 | import org.eclipse.lyo.oslc4j.core.annotation.OslcName; 47 | import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace; 48 | import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs; 49 | import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition; 50 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRdfCollectionType; 51 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRange; 52 | import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly; 53 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRepresentation; 54 | import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape; 55 | import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle; 56 | import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType; 57 | import org.eclipse.lyo.oslc4j.core.model.AbstractResource; 58 | import org.eclipse.lyo.oslc4j.core.model.Link; 59 | import org.eclipse.lyo.oslc4j.core.model.Occurs; 60 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 61 | import org.eclipse.lyo.oslc4j.core.model.Representation; 62 | import org.eclipse.lyo.oslc4j.core.model.ValueType; 63 | 64 | import com.sample.client.resources.Oslc_rmDomainConstants; 65 | import com.sample.client.resources.DctermsDomainConstants; 66 | 67 | 68 | // Start of user code imports 69 | // End of user code 70 | 71 | @OslcNamespace(Oslc_rmDomainConstants.REQUIREMENT_NAMESPACE) 72 | @OslcName(Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME) 73 | @OslcResourceShape(title = "Requirement Shape", describes = Oslc_rmDomainConstants.REQUIREMENT_TYPE) 74 | public interface IRequirement 75 | { 76 | 77 | 78 | @OslcName("identifier") 79 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "identifier") 80 | @OslcOccurs(Occurs.ExactlyOne) 81 | @OslcValueType(ValueType.String) 82 | @OslcReadOnly(false) 83 | public String getIdentifier(); 84 | 85 | @OslcName("title") 86 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "title") 87 | @OslcOccurs(Occurs.ExactlyOne) 88 | @OslcValueType(ValueType.String) 89 | @OslcReadOnly(false) 90 | public String getTitle(); 91 | 92 | @OslcName("description") 93 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "description") 94 | @OslcOccurs(Occurs.ExactlyOne) 95 | @OslcValueType(ValueType.String) 96 | @OslcReadOnly(false) 97 | public String getDescription(); 98 | 99 | 100 | public void setIdentifier(final String identifier ); 101 | public void setTitle(final String title ); 102 | public void setDescription(final String description ); 103 | } 104 | 105 | -------------------------------------------------------------------------------- /adaptor-client/src/main/java/com/sample/client/resources/ITestScript.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Sam Padgett - initial API and implementation 20 | * Michael Fiedler - adapted for OSLC4J 21 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 22 | * 23 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 24 | *******************************************************************************/ 25 | // End of user code 26 | 27 | package com.sample.client.resources; 28 | 29 | import java.net.URI; 30 | import java.net.URISyntaxException; 31 | import java.util.ArrayList; 32 | import java.util.Arrays; 33 | import java.util.Date; 34 | import java.util.HashMap; 35 | import java.util.Map; 36 | import java.text.SimpleDateFormat; 37 | import java.util.HashSet; 38 | import java.util.List; 39 | import java.util.Set; 40 | import java.util.TreeSet; 41 | import java.util.Iterator; 42 | 43 | import org.eclipse.lyo.oslc4j.core.annotation.OslcAllowedValue; 44 | import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription; 45 | import org.eclipse.lyo.oslc4j.core.annotation.OslcMemberProperty; 46 | import org.eclipse.lyo.oslc4j.core.annotation.OslcName; 47 | import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace; 48 | import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs; 49 | import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition; 50 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRdfCollectionType; 51 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRange; 52 | import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly; 53 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRepresentation; 54 | import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape; 55 | import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle; 56 | import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType; 57 | import org.eclipse.lyo.oslc4j.core.model.AbstractResource; 58 | import org.eclipse.lyo.oslc4j.core.model.Link; 59 | import org.eclipse.lyo.oslc4j.core.model.Occurs; 60 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 61 | import org.eclipse.lyo.oslc4j.core.model.Representation; 62 | import org.eclipse.lyo.oslc4j.core.model.ValueType; 63 | 64 | import com.sample.client.resources.Oslc_qmDomainConstants; 65 | import com.sample.client.resources.DctermsDomainConstants; 66 | import com.sample.client.resources.Oslc_qmDomainConstants; 67 | import com.sample.client.resources.Oslc_rmDomainConstants; 68 | 69 | import com.sample.client.resources.IRequirement; 70 | // Start of user code imports 71 | // End of user code 72 | 73 | @OslcNamespace(Oslc_qmDomainConstants.TESTSCRIPT_NAMESPACE) 74 | @OslcName(Oslc_qmDomainConstants.TESTSCRIPT_LOCALNAME) 75 | @OslcResourceShape(title = "TestScript Shape", describes = Oslc_qmDomainConstants.TESTSCRIPT_TYPE) 76 | public interface ITestScript 77 | { 78 | 79 | public void addValidatesRequirement(final Link validatesRequirement ); 80 | 81 | @OslcName("title") 82 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "title") 83 | @OslcOccurs(Occurs.ExactlyOne) 84 | @OslcValueType(ValueType.String) 85 | @OslcReadOnly(false) 86 | public String getTitle(); 87 | 88 | @OslcName("validatesRequirement") 89 | @OslcPropertyDefinition(Oslc_qmDomainConstants.QUALITY_MANAGEMENT_NAMSPACE + "validatesRequirement") 90 | @OslcOccurs(Occurs.ZeroOrMany) 91 | @OslcValueType(ValueType.Resource) 92 | @OslcRange({Oslc_rmDomainConstants.REQUIREMENT_TYPE}) 93 | @OslcReadOnly(false) 94 | public Set getValidatesRequirement(); 95 | 96 | @OslcName("description") 97 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "description") 98 | @OslcOccurs(Occurs.ExactlyOne) 99 | @OslcValueType(ValueType.String) 100 | @OslcReadOnly(false) 101 | public String getDescription(); 102 | 103 | 104 | public void setTitle(final String title ); 105 | public void setValidatesRequirement(final Set validatesRequirement ); 106 | public void setDescription(final String description ); 107 | } 108 | 109 | -------------------------------------------------------------------------------- /adaptor-client/src/main/java/com/sample/client/resources/Oslc_qmDomainConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.client.resources; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | 31 | // Start of user code imports 32 | // End of user code 33 | 34 | public interface Oslc_qmDomainConstants 35 | { 36 | // Start of user code user constants 37 | // End of user code 38 | 39 | public static String QUALITY_MANAGEMENT_DOMAIN = "http://open-services.net/ns/qm#"; 40 | public static String QUALITY_MANAGEMENT_NAMSPACE = "http://open-services.net/ns/qm#"; 41 | public static String QUALITY_MANAGEMENT_NAMSPACE_PREFIX = "oslc_qm"; 42 | 43 | public static String TESTCASE_PATH = "testCase"; 44 | public static String TESTCASE_NAMESPACE = QUALITY_MANAGEMENT_NAMSPACE; //namespace of the rdfs:class the resource describes 45 | public static String TESTCASE_LOCALNAME = "TestCase"; //localName of the rdfs:class the resource describes 46 | public static String TESTCASE_TYPE = TESTCASE_NAMESPACE + TESTCASE_LOCALNAME; //fullname of the rdfs:class the resource describes 47 | public static String TESTPLAN_PATH = "testPlan"; 48 | public static String TESTPLAN_NAMESPACE = QUALITY_MANAGEMENT_NAMSPACE; //namespace of the rdfs:class the resource describes 49 | public static String TESTPLAN_LOCALNAME = "TestPlan"; //localName of the rdfs:class the resource describes 50 | public static String TESTPLAN_TYPE = TESTPLAN_NAMESPACE + TESTPLAN_LOCALNAME; //fullname of the rdfs:class the resource describes 51 | public static String TESTSCRIPT_PATH = "testScript"; 52 | public static String TESTSCRIPT_NAMESPACE = QUALITY_MANAGEMENT_NAMSPACE; //namespace of the rdfs:class the resource describes 53 | public static String TESTSCRIPT_LOCALNAME = "TestScript"; //localName of the rdfs:class the resource describes 54 | public static String TESTSCRIPT_TYPE = TESTSCRIPT_NAMESPACE + TESTSCRIPT_LOCALNAME; //fullname of the rdfs:class the resource describes 55 | } 56 | -------------------------------------------------------------------------------- /adaptor-client/src/main/java/com/sample/client/resources/Oslc_rmDomainConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.client.resources; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | 31 | // Start of user code imports 32 | // End of user code 33 | 34 | public interface Oslc_rmDomainConstants 35 | { 36 | // Start of user code user constants 37 | // End of user code 38 | 39 | public static String REQUIREMENTS_MANAGEMENT_DOMAIN = "http://open-services.net/ns/rm#"; 40 | public static String REQUIREMENTS_MANAGEMENT_NAMSPACE = "http://open-services.net/ns/rm#"; 41 | public static String REQUIREMENTS_MANAGEMENT_NAMSPACE_PREFIX = "oslc_rm"; 42 | 43 | public static String REQUIREMENT_PATH = "requirement"; 44 | public static String REQUIREMENT_NAMESPACE = REQUIREMENTS_MANAGEMENT_NAMSPACE; //namespace of the rdfs:class the resource describes 45 | public static String REQUIREMENT_LOCALNAME = "Requirement"; //localName of the rdfs:class the resource describes 46 | public static String REQUIREMENT_TYPE = REQUIREMENT_NAMESPACE + REQUIREMENT_LOCALNAME; //fullname of the rdfs:class the resource describes 47 | } 48 | -------------------------------------------------------------------------------- /adaptor-client/src/main/java/com/sample/client/resources/package-info.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 20 | * 21 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 22 | *******************************************************************************/ 23 | // End of user code 24 | 25 | @OslcSchema ({ 26 | @OslcNamespaceDefinition(prefix = OslcConstants.DCTERMS_NAMESPACE_PREFIX, namespaceURI = OslcConstants.DCTERMS_NAMESPACE), 27 | @OslcNamespaceDefinition(prefix = OslcConstants.OSLC_CORE_NAMESPACE_PREFIX, namespaceURI = OslcConstants.OSLC_CORE_NAMESPACE), 28 | @OslcNamespaceDefinition(prefix = OslcConstants.OSLC_DATA_NAMESPACE_PREFIX, namespaceURI = OslcConstants.OSLC_DATA_NAMESPACE), 29 | @OslcNamespaceDefinition(prefix = OslcConstants.RDF_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDF_NAMESPACE), 30 | @OslcNamespaceDefinition(prefix = OslcConstants.RDFS_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDFS_NAMESPACE), 31 | @OslcNamespaceDefinition(prefix = DctermsDomainConstants.DUBLIN_CORE_NAMSPACE_PREFIX, namespaceURI = DctermsDomainConstants.DUBLIN_CORE_NAMSPACE), 32 | @OslcNamespaceDefinition(prefix = Oslc_qmDomainConstants.QUALITY_MANAGEMENT_NAMSPACE_PREFIX, namespaceURI = Oslc_qmDomainConstants.QUALITY_MANAGEMENT_NAMSPACE), 33 | @OslcNamespaceDefinition(prefix = Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_NAMSPACE_PREFIX, namespaceURI = Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_NAMSPACE) 34 | }) 35 | package com.sample.client.resources; 36 | 37 | import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespaceDefinition; 38 | import org.eclipse.lyo.oslc4j.core.annotation.OslcSchema; 39 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 40 | 41 | import com.sample.client.resources.DctermsDomainConstants; 42 | import com.sample.client.resources.Oslc_qmDomainConstants; 43 | import com.sample.client.resources.Oslc_rmDomainConstants; 44 | 45 | -------------------------------------------------------------------------------- /adaptor-client/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | ClientOnlyApplication 7 | 8 | Base URI for the adaptor. 9 | com.sample.client.servlet.baseurl 10 | http://localhost:8080/ 11 | 13 | 14 | 16 | 17 | 19 | 20 | 22 | 23 | Listener for ServletContext lifecycle changes 24 | com.sample.client.servlet.ServletListener 25 | 26 | 28 | 29 | 31 | 32 | JAX-RS Servlet 33 | org.glassfish.jersey.servlet.ServletContainer 34 | 35 | javax.ws.rs.Application 36 | com.sample.client.servlet.Application 37 | 38 | 1 39 | 40 | 42 | 43 | 45 | 46 | JAX-RS Servlet 47 | /services/* 48 | 49 | 51 | 52 | 54 | 55 | -------------------------------------------------------------------------------- /adaptor-client/src/main/webapp/com/sample/client/requirementtohtml.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | <%-- 3 | Copyright (c) 2020 Contributors to the Eclipse Foundation 4 | 5 | See the NOTICE file(s) distributed with this work for additional 6 | information regarding copyright ownership. 7 | 8 | This program and the accompanying materials are made available under the 9 | terms of the Eclipse Distribution License 1.0 which is available at 10 | http://www.eclipse.org/org/documents/edl-v10.php. 11 | 12 | SPDX-License-Identifier: BSD-3-Simple 13 | 14 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 15 | --%> 16 | 17 | <%@page import="com.sample.client.resources.Requirement"%> 18 | <%@page import="java.net.URI"%> 19 | <% 20 | String asLocalResource = request.getParameter("asLocalResource"); 21 | Requirement aResource = null; 22 | if (request.getParameter("resourceUri") != null) { 23 | aResource = new Requirement (new URI(request.getParameter("resourceUri"))); 24 | } 25 | else { 26 | if (request.getAttribute("aRequirement") != null) { 27 | aResource = (Requirement) request.getAttribute("aRequirement"); 28 | } 29 | } 30 | 31 | if (asLocalResource != null && asLocalResource.equalsIgnoreCase("true")) { 32 | out.write("{a Local Requirement Resource} - update Requirement.toString() to present resource as desired."); 33 | } 34 | else { 35 | if (aResource == null) { 36 | out.write("null"); 37 | } 38 | else { 39 | out.write("" + aResource.getAbout() + ""); 40 | } 41 | } 42 | %> 43 | -------------------------------------------------------------------------------- /adaptor-client/src/main/webapp/com/sample/client/testscripttohtml.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | <%-- 3 | Copyright (c) 2020 Contributors to the Eclipse Foundation 4 | 5 | See the NOTICE file(s) distributed with this work for additional 6 | information regarding copyright ownership. 7 | 8 | This program and the accompanying materials are made available under the 9 | terms of the Eclipse Distribution License 1.0 which is available at 10 | http://www.eclipse.org/org/documents/edl-v10.php. 11 | 12 | SPDX-License-Identifier: BSD-3-Simple 13 | 14 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 15 | --%> 16 | 17 | <%@page import="com.sample.client.resources.TestScript"%> 18 | <%@page import="java.net.URI"%> 19 | <% 20 | String asLocalResource = request.getParameter("asLocalResource"); 21 | TestScript aResource = null; 22 | if (request.getParameter("resourceUri") != null) { 23 | aResource = new TestScript (new URI(request.getParameter("resourceUri"))); 24 | } 25 | else { 26 | if (request.getAttribute("aTestScript") != null) { 27 | aResource = (TestScript) request.getAttribute("aTestScript"); 28 | } 29 | } 30 | 31 | if (asLocalResource != null && asLocalResource.equalsIgnoreCase("true")) { 32 | out.write("{a Local TestScript Resource} - update TestScript.toString() to present resource as desired."); 33 | } 34 | else { 35 | if (aResource == null) { 36 | out.write("null"); 37 | } 38 | else { 39 | out.write("" + aResource.getAbout() + ""); 40 | } 41 | } 42 | %> 43 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /overlays/ 3 | /.settings/ 4 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | adaptor-rm-webapp 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.jdt.core.javanature 33 | org.eclipse.m2e.core.maven2Nature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | org.eclipse.wst.jsdt.core.jsNature 36 | 37 | 38 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | ## Getting started 4 | 5 | Run the adaptor as a regular web application: 6 | 7 | mvn clean jetty:run-war 8 | 9 | Alternatively, with Tomcat via Maven Cargo: 10 | 11 | mvn clean package cargo:run 12 | 13 | You can then explore the server starting with its [front page on localhost:8083](http://localhost:8083/adaptor-rm/) where you can navigate through its HTML pages, or access its Swagger interface. 14 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/Backend.java: -------------------------------------------------------------------------------- 1 | package com.sample.rm; 2 | 3 | import javax.inject.Inject; 4 | import javax.servlet.http.HttpServletRequest; 5 | import java.util.ArrayList; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import com.sample.rm.resources.Requirement; 9 | import org.eclipse.lyo.oslc4j.trs.server.TrsEventHandler; 10 | import java.net.URI; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | public class Backend { 15 | 16 | private static final Logger log = LoggerFactory.getLogger(Backend.class); 17 | 18 | @Inject ResourcesFactory resourcesFactory; 19 | 20 | private static Map requirements = new HashMap(1000); 21 | private static int nextRequirementId; 22 | 23 | public Backend() { 24 | log.trace("Backend is initialized"); 25 | } 26 | 27 | public ArrayList getRequirements() { 28 | return new ArrayList(requirements.values()); 29 | } 30 | 31 | public Requirement getRequirement(String id) { 32 | return requirements.get(id); 33 | } 34 | 35 | public Requirement produceRandomRequirement(String id) { 36 | Requirement r = null; 37 | r = resourcesFactory.createRequirement(id); 38 | r.setIdentifier(id); 39 | r.setTitle("aTitle with id:" + id); 40 | r.setDescription("A sample Requirement with id:" + id); 41 | return r; 42 | } 43 | 44 | public void initializeRequirements(int size) { 45 | for (int i = 0; i < size; i++) { 46 | nextRequirementId++; 47 | String id = Integer.toString(nextRequirementId); 48 | Requirement r = produceRandomRequirement(id); 49 | requirements.put(id, r); 50 | } 51 | } 52 | 53 | public Requirement createOrUpdateRequirement(HttpServletRequest httpServletRequest, final Requirement aResource) { 54 | if (!requirements.containsKey(aResource.getIdentifier())) { 55 | nextRequirementId++; 56 | String id = Integer.toString(nextRequirementId); 57 | URI uri = resourcesFactory.constructURIForRequirement(id); 58 | aResource.setAbout(uri); 59 | requirements.put(id, aResource); 60 | } 61 | else { 62 | URI uri = resourcesFactory.constructURIForRequirement(aResource.getIdentifier()); 63 | aResource.setAbout(uri); 64 | requirements.put(aResource.getIdentifier(), aResource); 65 | } 66 | return aResource; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/RMToolConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.rm; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | // Start of user code imports 31 | // End of user code 32 | 33 | public interface RMToolConstants 34 | { 35 | // Start of user code user constants 36 | // End of user code 37 | 38 | public static final String HDR_OSLC_VERSION = "OSLC-Core-Version"; 39 | public static final String OSLC_VERSION_V2 = "2.0"; 40 | } 41 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/ResourcesFactory.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2017 Jad El-khoury. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Jad El-khoury - initial implementation 16 | * 17 | *******************************************************************************/ 18 | // End of user code 19 | 20 | package com.sample.rm; 21 | 22 | 23 | import java.net.URI; 24 | import java.net.URISyntaxException; 25 | import java.util.HashMap; 26 | import java.util.Map; 27 | import javax.ws.rs.core.UriBuilder; 28 | 29 | import org.eclipse.lyo.oslc4j.core.model.Link; 30 | import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; 31 | import com.sample.rm.resources.Requirement; 32 | 33 | // Start of user code imports 34 | // End of user code 35 | 36 | // Start of user code pre_class_code 37 | // End of user code 38 | 39 | public class ResourcesFactory { 40 | 41 | private String basePath; 42 | 43 | // Start of user code class_attributes 44 | // End of user code 45 | 46 | public ResourcesFactory(String basePath) { 47 | this.basePath = basePath; 48 | } 49 | 50 | // Start of user code class_methods 51 | // End of user code 52 | 53 | //methods for Requirement resource 54 | 55 | public Requirement createRequirement(final String requirementId) { 56 | return new Requirement(constructURIForRequirement(requirementId)); 57 | } 58 | 59 | public URI constructURIForRequirement(final String requirementId) { 60 | Map pathParameters = new HashMap(); 61 | pathParameters.put("requirementId", requirementId); 62 | String instanceURI = "requirements/{requirementId}"; 63 | 64 | final UriBuilder builder = UriBuilder.fromUri(this.basePath); 65 | return builder.path(instanceURI).buildFromMap(pathParameters); 66 | } 67 | 68 | public Link constructLinkForRequirement(final String requirementId , final String label) { 69 | return new Link(constructURIForRequirement(requirementId), label); 70 | } 71 | 72 | public Link constructLinkForRequirement(final String requirementId) { 73 | return new Link(constructURIForRequirement(requirementId)); 74 | } 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/ServerConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /* 3 | * Copyright (c) 2020 Contributors to the Eclipse Foundation 4 | * 5 | * See the NOTICE file(s) distributed with this work for additional 6 | * information regarding copyright ownership. 7 | * 8 | * This program and the accompanying materials are made available under the 9 | * terms of the Eclipse Distribution License 1.0 which is available at 10 | * http://www.eclipse.org/org/documents/edl-v10.php. 11 | * 12 | * SPDX-License-Identifier: BSD-3-Simple 13 | * 14 | * This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 15 | */ 16 | // End of user code 17 | 18 | package com.sample.rm; 19 | 20 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 21 | 22 | // Start of user code imports 23 | // End of user code 24 | 25 | public interface ServerConstants 26 | { 27 | // Start of user code user constants 28 | // End of user code 29 | 30 | public static final String HDR_OSLC_VERSION = "OSLC-Core-Version"; 31 | public static final String OSLC_VERSION_V2 = "2.0"; 32 | } 33 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/ServiceProviderInfo.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2014 Jad El-khoury. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 16 | * 17 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 18 | *******************************************************************************/ 19 | // End of user code 20 | 21 | package com.sample.rm; 22 | 23 | // Start of user code imports 24 | // End of user code 25 | 26 | // Start of user code pre_class_code 27 | // End of user code 28 | public class ServiceProviderInfo { 29 | public String name; 30 | public String serviceProviderId; 31 | 32 | // Start of user code class_attributes 33 | // End of user code 34 | 35 | // Start of user code class_methods 36 | // End of user code 37 | } 38 | 39 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/clients/GenericRequiredAdaptorClient.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2015 Jad El-khoury. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Jad El-khoury - initial implementation of client code 16 | * 17 | *******************************************************************************/ 18 | // End of user code 19 | 20 | package com.sample.rm.clients; 21 | 22 | import javax.ws.rs.core.Response; 23 | import org.eclipse.lyo.client.OSLCConstants; 24 | import org.eclipse.lyo.client.OslcClient; 25 | import org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog; 26 | 27 | // Start of user code imports 28 | // End of user code 29 | 30 | 31 | // Start of user code pre_class_code 32 | // End of user code 33 | 34 | public class GenericRequiredAdaptorClient 35 | { 36 | 37 | // Start of user code class_attributes 38 | // End of user code 39 | 40 | // Start of user code class_methods 41 | // End of user code 42 | 43 | static String serviceProviderCatalogURI = "http://your.host/adaptor/services/catalog/singleton"; 44 | 45 | public static ServiceProviderCatalog getServiceProviderCatalog() throws Exception { 46 | OslcClient client = new OslcClient(); 47 | Response response = null; 48 | ServiceProviderCatalog catalog = null; 49 | 50 | // Start of user code getServiceProviderCatalog_init 51 | // End of user code 52 | 53 | response = client.getResource(serviceProviderCatalogURI,OSLCConstants.CT_RDF); 54 | if (response != null) { 55 | catalog = response.readEntity(ServiceProviderCatalog.class); 56 | } 57 | // Start of user code getServiceProviderCatalog_final 58 | // End of user code 59 | return catalog; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/resources/DctermsDomainConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.rm.resources; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | 31 | // Start of user code imports 32 | // End of user code 33 | 34 | public interface DctermsDomainConstants 35 | { 36 | // Start of user code user constants 37 | // End of user code 38 | 39 | /** 40 | * @deprecated use {@link DctermsDomainConstants#DUBLIN_CORE_NAMSPACE} or {@link DctermsDomainConstants#DUBLIN_CORE_DOMAIN_NAME} instead 41 | */ 42 | @Deprecated(since = "5.0.1") 43 | public static String DUBLIN_CORE_DOMAIN = "http://purl.org/dc/terms/"; 44 | public static String DUBLIN_CORE_DOMAIN_NAME = "Dublin Core"; 45 | public static String DUBLIN_CORE_NAMSPACE = "http://purl.org/dc/terms/"; //Vocabulary namespace for the resources and resource properties, when no explicit vocabulary (describes, or propertyDefinition) is defined 46 | public static String DUBLIN_CORE_NAMSPACE_PREFIX = "dcterms"; //Vocabulary prefix for the resources and resource properties, when no explicit vocabulary (describes, or propertyDefinition) is defined 47 | 48 | } 49 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/resources/FoafDomainConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.rm.resources; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | 31 | // Start of user code imports 32 | // End of user code 33 | 34 | public interface FoafDomainConstants 35 | { 36 | // Start of user code user constants 37 | // End of user code 38 | 39 | public static String FOAF_DOMAIN = "http://xmlns.com/foaf/0.1/"; 40 | public static String FOAF_NAMSPACE = "http://xmlns.com/foaf/0.1/"; 41 | public static String FOAF_NAMSPACE_PREFIX = "foaf"; 42 | 43 | public static String PERSON_PATH = "person"; 44 | public static String PERSON_NAMESPACE = FOAF_NAMSPACE; //namespace of the rdfs:class the resource describes 45 | public static String PERSON_LOCALNAME = "Person"; //localName of the rdfs:class the resource describes 46 | public static String PERSON_TYPE = PERSON_NAMESPACE + PERSON_LOCALNAME; //fullname of the rdfs:class the resource describes 47 | } 48 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/resources/IRequirement.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Sam Padgett - initial API and implementation 20 | * Michael Fiedler - adapted for OSLC4J 21 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 22 | * 23 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 24 | *******************************************************************************/ 25 | // End of user code 26 | 27 | package com.sample.rm.resources; 28 | 29 | import java.net.URI; 30 | import java.net.URISyntaxException; 31 | import java.util.ArrayList; 32 | import java.util.Arrays; 33 | import java.util.Date; 34 | import java.util.HashMap; 35 | import java.util.Map; 36 | import java.text.SimpleDateFormat; 37 | import java.util.HashSet; 38 | import java.util.List; 39 | import java.util.Set; 40 | import java.util.TreeSet; 41 | import java.util.Iterator; 42 | 43 | import org.eclipse.lyo.oslc4j.core.annotation.OslcAllowedValue; 44 | import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription; 45 | import org.eclipse.lyo.oslc4j.core.annotation.OslcMemberProperty; 46 | import org.eclipse.lyo.oslc4j.core.annotation.OslcName; 47 | import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace; 48 | import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs; 49 | import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition; 50 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRdfCollectionType; 51 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRange; 52 | import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly; 53 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRepresentation; 54 | import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape; 55 | import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle; 56 | import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType; 57 | import org.eclipse.lyo.oslc4j.core.model.AbstractResource; 58 | import org.eclipse.lyo.oslc4j.core.model.Link; 59 | import org.eclipse.lyo.oslc4j.core.model.Occurs; 60 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 61 | import org.eclipse.lyo.oslc4j.core.model.Representation; 62 | import org.eclipse.lyo.oslc4j.core.model.ValueType; 63 | 64 | import com.sample.rm.resources.Oslc_rmDomainConstants; 65 | import com.sample.rm.resources.DctermsDomainConstants; 66 | // Start of user code imports 67 | // End of user code 68 | 69 | @OslcNamespace(Oslc_rmDomainConstants.REQUIREMENT_NAMESPACE) 70 | @OslcName(Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME) 71 | @OslcResourceShape(title = "Requirement Shape", describes = Oslc_rmDomainConstants.REQUIREMENT_TYPE) 72 | public interface IRequirement 73 | { 74 | 75 | 76 | @OslcName("identifier") 77 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "identifier") 78 | @OslcOccurs(Occurs.ExactlyOne) 79 | @OslcValueType(ValueType.String) 80 | @OslcReadOnly(false) 81 | public String getIdentifier(); 82 | 83 | @OslcName("title") 84 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "title") 85 | @OslcOccurs(Occurs.ExactlyOne) 86 | @OslcValueType(ValueType.String) 87 | @OslcReadOnly(false) 88 | public String getTitle(); 89 | 90 | @OslcName("description") 91 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "description") 92 | @OslcOccurs(Occurs.ExactlyOne) 93 | @OslcValueType(ValueType.String) 94 | @OslcReadOnly(false) 95 | public String getDescription(); 96 | 97 | 98 | public void setIdentifier(final String identifier ); 99 | public void setTitle(final String title ); 100 | public void setDescription(final String description ); 101 | } 102 | 103 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/resources/Oslc_rmDomainConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.rm.resources; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | 31 | // Start of user code imports 32 | // End of user code 33 | 34 | public interface Oslc_rmDomainConstants 35 | { 36 | // Start of user code user constants 37 | // End of user code 38 | 39 | /** 40 | * @deprecated use {@link Oslc_rmDomainConstants#REQUIREMENTS_MANAGEMENT_NAMSPACE} or {@link Oslc_rmDomainConstants#REQUIREMENTS_MANAGEMENT_DOMAIN_NAME} instead 41 | */ 42 | @Deprecated(since = "5.0.1") 43 | public static String REQUIREMENTS_MANAGEMENT_DOMAIN = "http://open-services.net/ns/rm#"; 44 | public static String REQUIREMENTS_MANAGEMENT_DOMAIN_NAME = "Requirements Management"; 45 | public static String REQUIREMENTS_MANAGEMENT_NAMSPACE = "http://open-services.net/ns/rm#"; //Vocabulary namespace for the resources and resource properties, when no explicit vocabulary (describes, or propertyDefinition) is defined 46 | public static String REQUIREMENTS_MANAGEMENT_NAMSPACE_PREFIX = "oslc_rm"; //Vocabulary prefix for the resources and resource properties, when no explicit vocabulary (describes, or propertyDefinition) is defined 47 | 48 | public static String REQUIREMENT_PATH = "requirement"; //the relative path of the resource shape URL. 49 | public static String REQUIREMENT_NAMESPACE = Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_NAMSPACE; //namespace of the rdfs:class the resource describes 50 | public static String REQUIREMENT_LOCALNAME = "Requirement"; //localName of the rdfs:class the resource describes 51 | public static String REQUIREMENT_TYPE = REQUIREMENT_NAMESPACE + REQUIREMENT_LOCALNAME; //fullname of the rdfs:class the resource describes 52 | } 53 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/resources/package-info.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 20 | * 21 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 22 | *******************************************************************************/ 23 | // End of user code 24 | 25 | @OslcSchema ({ 26 | @OslcNamespaceDefinition(prefix = OslcConstants.DCTERMS_NAMESPACE_PREFIX, namespaceURI = OslcConstants.DCTERMS_NAMESPACE), 27 | @OslcNamespaceDefinition(prefix = OslcConstants.OSLC_CORE_NAMESPACE_PREFIX, namespaceURI = OslcConstants.OSLC_CORE_NAMESPACE), 28 | @OslcNamespaceDefinition(prefix = OslcConstants.OSLC_DATA_NAMESPACE_PREFIX, namespaceURI = OslcConstants.OSLC_DATA_NAMESPACE), 29 | @OslcNamespaceDefinition(prefix = OslcConstants.RDF_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDF_NAMESPACE), 30 | @OslcNamespaceDefinition(prefix = OslcConstants.RDFS_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDFS_NAMESPACE), 31 | @OslcNamespaceDefinition(prefix = Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_NAMSPACE_PREFIX, namespaceURI = Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_NAMSPACE), 32 | }) 33 | package com.sample.rm.resources; 34 | 35 | import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespaceDefinition; 36 | import org.eclipse.lyo.oslc4j.core.annotation.OslcSchema; 37 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 38 | import com.sample.rm.resources.Oslc_rmDomainConstants; 39 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/services/ResourceShapeService.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2017 Jad El-khoury. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Jad El-khoury - initial implementation of ResourceShape HTML presentation 16 | * 17 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 18 | *******************************************************************************/ 19 | // End of user code 20 | 21 | package com.sample.rm.services; 22 | 23 | import java.io.IOException; 24 | import java.lang.reflect.InvocationTargetException; 25 | import java.net.URISyntaxException; 26 | import java.util.Map; 27 | import java.util.Set; 28 | import org.slf4j.Logger; 29 | import org.slf4j.LoggerFactory; 30 | 31 | import javax.servlet.RequestDispatcher; 32 | import javax.servlet.ServletException; 33 | import javax.servlet.http.HttpServletRequest; 34 | import javax.servlet.http.HttpServletResponse; 35 | import javax.ws.rs.GET; 36 | import javax.ws.rs.Path; 37 | import javax.ws.rs.PathParam; 38 | import javax.ws.rs.Produces; 39 | import javax.ws.rs.WebApplicationException; 40 | import javax.ws.rs.core.Context; 41 | import javax.ws.rs.core.MediaType; 42 | import javax.ws.rs.core.Response; 43 | import javax.ws.rs.core.Response.Status; 44 | import javax.ws.rs.core.UriInfo; 45 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 46 | import org.eclipse.lyo.oslc4j.core.model.OslcMediaType; 47 | import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; 48 | import org.eclipse.lyo.oslc4j.core.exception.OslcCoreApplicationException; 49 | import org.eclipse.lyo.oslc4j.core.model.ResourceShape; 50 | import org.eclipse.lyo.oslc4j.core.model.ResourceShapeFactory; 51 | 52 | import io.swagger.v3.oas.annotations.Operation; 53 | 54 | import com.sample.rm.servlet.Application; 55 | 56 | // Start of user code imports 57 | // End of user code 58 | 59 | // Start of user code pre_class_code 60 | // End of user code 61 | 62 | @Path(OslcConstants.PATH_RESOURCE_SHAPES) 63 | public class ResourceShapeService 64 | { 65 | @Context private HttpServletRequest httpServletRequest; 66 | @Context private HttpServletResponse httpServletResponse; 67 | @Context private UriInfo uriInfo; 68 | @Context private javax.ws.rs.core.Application jaxrsApplication; 69 | 70 | private static final Logger log = LoggerFactory.getLogger(ResourceShapeService.class.getName()); 71 | 72 | public ResourceShapeService() throws OslcCoreApplicationException, URISyntaxException { 73 | super(); 74 | } 75 | 76 | @GET 77 | @Path("{resourceShapePath}") 78 | @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.TEXT_XML, OslcMediaType.APPLICATION_JSON, OslcMediaType.TEXT_TURTLE}) 79 | @Operation(hidden = true) 80 | public ResourceShape getResourceShape(@Context final HttpServletRequest httpServletRequest, 81 | @PathParam("resourceShapePath") final String resourceShapePath) 82 | throws OslcCoreApplicationException, 83 | URISyntaxException 84 | { 85 | final Class resourceClass = Application.getResourceShapePathToResourceClassMap().get(resourceShapePath); 86 | if (resourceClass != null) { 87 | final String servletUri = OSLC4JUtils.resolveServletUri(httpServletRequest); 88 | return ResourceShapeFactory.createResourceShape(servletUri, OslcConstants.PATH_RESOURCE_SHAPES, 89 | resourceShapePath, resourceClass); 90 | } 91 | throw new WebApplicationException(Response.Status.NOT_FOUND); 92 | } 93 | 94 | @GET 95 | @Path("{resourceShapePath}") 96 | @Produces({ MediaType.TEXT_HTML }) 97 | public void getResourceShapeAsHtml( 98 | @PathParam("resourceShapePath") final String resourceShapePath 99 | ) throws ServletException, IOException, URISyntaxException, OslcCoreApplicationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException 100 | { 101 | final Class resourceClass = Application.getResourceShapePathToResourceClassMap().get(resourceShapePath); 102 | ResourceShape aResourceShape = null; 103 | 104 | if (resourceClass != null) 105 | { 106 | aResourceShape = (ResourceShape) resourceClass.getMethod("createResourceShape").invoke(null); 107 | httpServletRequest.setAttribute("aResourceShape", aResourceShape); 108 | 109 | RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/com/sample/rm/resourceshape.jsp"); 110 | rd.forward(httpServletRequest,httpServletResponse); 111 | return; 112 | } 113 | throw new WebApplicationException(Status.NOT_FOUND); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/java/com/sample/rm/servlet/ApplicationBinder.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /* 3 | * Copyright (c) 2020 Contributors to the Eclipse Foundation 4 | * 5 | * See the NOTICE file(s) distributed with this work for additional 6 | * information regarding copyright ownership. 7 | * 8 | * This program and the accompanying materials are made available under the 9 | * terms of the Eclipse Distribution License 1.0 which is available at 10 | * http://www.eclipse.org/org/documents/edl-v10.php. 11 | * 12 | * SPDX-License-Identifier: BSD-3-Simple 13 | * 14 | * This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 15 | */ 16 | // End of user code 17 | 18 | package com.sample.rm.servlet; 19 | 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | import org.glassfish.hk2.api.Factory; 23 | import org.glassfish.hk2.utilities.binding.AbstractBinder; 24 | 25 | import javax.inject.Singleton; 26 | 27 | import com.sample.rm.RestDelegate; 28 | import com.sample.rm.ResourcesFactory; 29 | 30 | import java.net.URI; 31 | import java.util.ArrayList; 32 | import org.eclipse.lyo.oslc4j.trs.server.InmemPagedTrs; 33 | import org.eclipse.lyo.oslc4j.trs.server.PagedTrs; 34 | import org.eclipse.lyo.oslc4j.trs.server.PagedTrsFactory; 35 | import org.eclipse.lyo.oslc4j.trs.server.TrsEventHandler; 36 | import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; 37 | // Start of user code imports 38 | import javax.inject.Inject; 39 | import java.util.Iterator; 40 | import com.sample.rm.resources.Requirement; 41 | import com.sample.rm.Backend; 42 | // End of user code 43 | 44 | // Start of user code pre_class_code 45 | // End of user code 46 | 47 | public class ApplicationBinder extends AbstractBinder { 48 | 49 | private static final Logger log = LoggerFactory.getLogger(ApplicationBinder.class); 50 | 51 | // Start of user code class_attributes 52 | // End of user code 53 | 54 | // Start of user code class_methods 55 | // End of user code 56 | 57 | public ApplicationBinder() 58 | { 59 | log.info("HK2 contract binding init"); 60 | } 61 | 62 | @Override 63 | protected void configure() { 64 | log.info("HK2 contract binding start"); 65 | 66 | // Start of user code ConfigureInitialise 67 | bindAsContract(Backend.class).in(Singleton.class); 68 | // End of user code 69 | bindAsContract(RestDelegate.class).in(Singleton.class); 70 | bindFactory(ResourcesFactoryFactory.class).to(ResourcesFactory.class).in(Singleton.class); 71 | 72 | 73 | bindFactory(InmemTrsEventHandlerFactory.class).to(TrsEventHandler.class).in(Singleton.class); 74 | bindFactory(InmemPagedTrsFactory.class).to(PagedTrs.class).in(Singleton.class); 75 | 76 | // Start of user code ConfigureFinalize 77 | // End of user code 78 | } 79 | static class ResourcesFactoryFactory implements Factory { 80 | @Override 81 | public ResourcesFactory provide() { 82 | return new ResourcesFactory(OSLC4JUtils.getServletURI()); 83 | } 84 | 85 | @Override 86 | public void dispose(ResourcesFactory instance) { 87 | } 88 | } 89 | 90 | static class InmemTrsEventHandlerFactory implements Factory { 91 | // Start of user code TrsEventHandlerInitialise 92 | @Inject Backend backend; 93 | // End of user code 94 | 95 | @Override 96 | public TrsEventHandler provide() { 97 | ArrayList uris = new ArrayList(); 98 | // Start of user code TrsEventHandlerInitialBase 99 | backend.initializeRequirements(37); 100 | ArrayList requirements = backend.getRequirements(); 101 | for (Iterator iterator = requirements.iterator(); iterator.hasNext();) { 102 | uris.add(((Requirement) iterator.next()).getAbout()); 103 | } 104 | // End of user code 105 | 106 | InmemPagedTrs inmemTrs = new PagedTrsFactory().getInmemPagedTrs(50, 50, uris); 107 | return inmemTrs; 108 | } 109 | 110 | @Override 111 | public void dispose(TrsEventHandler instance) { 112 | // Start of user code TrsEventHandlerDispose 113 | // End of user code 114 | } 115 | } 116 | 117 | static class InmemPagedTrsFactory implements Factory { 118 | @Inject TrsEventHandler trsEventHandler; 119 | 120 | @Override 121 | public PagedTrs provide() { 122 | // Start of user code PagedTrsInitialise 123 | // End of user code 124 | return (InmemPagedTrs) trsEventHandler; 125 | } 126 | 127 | @Override 128 | public void dispose(PagedTrs instance) { 129 | // Start of user code PagedTrsDispose 130 | // End of user code 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # https://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html 2 | # Must be one of ("trace", "debug", "info", "warn", "error" or "off"). 3 | # If not specified, defaults to "info". 4 | org.slf4j.simpleLogger.logFile = System.out 5 | org.slf4j.simpleLogger.showLogName = true 6 | org.slf4j.simpleLogger.showDateTime = true 7 | org.slf4j.simpleLogger.levelInBrackets = true 8 | 9 | org.slf4j.simpleLogger.defaultLogLevel = DEBUG 10 | org.slf4j.simpleLogger.showThreadName = false 11 | org.slf4j.simpleLogger.dateTimeFormat = HH:mm:ss.SSS 12 | org.slf4j.simpleLogger.showShortLogName = false 13 | 14 | ## General Lyo levels 15 | org.slf4j.simpleLogger.log.org.eclipse.lyo = TRACE 16 | org.slf4j.simpleLogger.log.com.sample.rm = TRACE 17 | 18 | ## Configurable levels 19 | # set to DEBUG to see HTTP responses on the wire 20 | org.slf4j.simpleLogger.log.org.apache.http = INFO 21 | # use TRACE to debug DI issues 22 | #org.slf4j.simpleLogger.log.org.jboss.weld = TRACE 23 | 24 | ## Levels to reduce the "noise" 25 | org.slf4j.simpleLogger.log.org.apache.jena = INFO 26 | org.slf4j.simpleLogger.log.io.swagger.v3 = INFO 27 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/WEB-INF/jboss-all.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | RM Tool 7 | 8 | Base URI for the adaptor. 9 | com.sample.rm.servlet.baseurl 10 | http://localhost:8083/ 11 | 13 | 14 | 16 | 17 | 19 | 20 | 22 | 23 | Listener for ServletContext lifecycle changes 24 | com.sample.rm.servlet.ServletListener 25 | 26 | 28 | 29 | 31 | 32 | JAX-RS Servlet 33 | org.glassfish.jersey.servlet.ServletContainer 34 | 35 | javax.ws.rs.Application 36 | com.sample.rm.servlet.Application 37 | 38 | 1 39 | 40 | 42 | 43 | 45 | 46 | JAX-RS Servlet 47 | /services/* 48 | 49 | 51 | 52 | 54 | 55 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/com/sample/rm/requirementcreator.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | 3 | <%-- 4 | Copyright (c) 2020 Contributors to the Eclipse Foundation 5 | 6 | See the NOTICE file(s) distributed with this work for additional 7 | information regarding copyright ownership. 8 | 9 | This program and the accompanying materials are made available under the 10 | terms of the Eclipse Distribution License 1.0 which is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: BSD-3-Simple 14 | 15 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 16 | --%> 17 | 18 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 19 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 20 | 21 | <%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%> 22 | <%@page import="java.util.List" %> 23 | <%@page import="com.sample.rm.resources.Requirement"%> 24 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> 25 | <%@page import="javax.ws.rs.core.UriBuilder"%> 26 | 27 | <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> 28 | 29 | <% 30 | String creatorUri = (String) request.getAttribute("creatorUri"); 31 | %> 32 | 33 | 34 | 35 | 36 | CreationDialog1 37 | 38 | 39 | 40 |
41 |
42 | 43 | 44 | 50 | 51 | 52 | 58 | 59 | 60 | 66 | 67 | 68 | 69 | 75 | 76 |
45 | 46 | <% 47 | out.write(""); 48 | %> 49 |
53 | 54 | <% 55 | out.write(""); 56 | %> 57 |
61 | 62 | <% 63 | out.write(""); 64 | %> 65 |
70 | 73 | 74 |
77 |
78 |
79 |
80 | 81 |
82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/com/sample/rm/requirementscollection.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | 3 | <%-- 4 | Copyright (c) 2022 Contributors to the Eclipse Foundation 5 | 6 | See the NOTICE file(s) distributed with this work for additional 7 | information regarding copyright ownership. 8 | 9 | This program and the accompanying materials are made available under the 10 | terms of the Eclipse Distribution License 1.0 which is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: BSD-3-Simple 14 | 15 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 16 | --%> 17 | 18 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 19 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 20 | 21 | <%@page import="javax.ws.rs.core.UriBuilder"%> 22 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> 23 | <%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%> 24 | <%@page import="org.eclipse.lyo.oslc4j.core.model.AbstractResource"%> 25 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JConstants"%> 26 | <%@page import="java.util.List" %> 27 | 28 | <%@page import="com.sample.rm.resources.Requirement"%> 29 | <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> 30 | <% 31 | List resources = (List) request.getAttribute("resources"); 32 | String queryUri = (String)request.getAttribute("queryUri"); 33 | String nextPageUri = (String)request.getAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE); 34 | String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); 35 | %> 36 | 37 | 38 | 39 | 40 | 41 | Query capability QueryCapability 42 | 43 | 44 | 45 | 46 | 47 | " rel="stylesheet"> 48 | 49 | 52 | 53 | 54 | 55 | 56 | 65 | 66 |
67 | 75 | 87 | <% for (Requirement aResource : resources) { %> 88 |

<%=aResource.toString()%>

89 | <% } %> 90 |
91 |
92 |
93 |

OSLC Adaptor was generated using Eclipse Lyo.

94 |
95 |
96 | 97 | 98 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/com/sample/rm/requirementtohtml.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | <%-- 3 | Copyright (c) 2018 Jad El-khoury. 4 | 5 | All rights reserved. This program and the accompanying materials 6 | are made available under the terms of the Eclipse Public License v1.0 7 | and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | 9 | The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | 15 | Jad El-khoury - Migrate toHtml methods from the resource pojos to be embedded in jsp pages. 16 | 17 | This file is generated by org.eclipse.lyo.oslc4j.codegenerator 18 | --%> 19 | 20 | <%@page import="com.sample.rm.resources.Requirement"%> 21 | <%@page import="java.net.URI"%> 22 | <% 23 | String asLocalResource = request.getParameter("asLocalResource"); 24 | Requirement aResource = null; 25 | if (request.getParameter("resourceUri") != null) { 26 | aResource = new Requirement (new URI(request.getParameter("resourceUri"))); 27 | } 28 | else { 29 | if (request.getAttribute("aRequirement") != null) { 30 | aResource = (Requirement) request.getAttribute("aRequirement"); 31 | } 32 | } 33 | 34 | if (asLocalResource != null && asLocalResource.equalsIgnoreCase("true")) { 35 | out.write("{a Local Requirement Resource} - update Requirement.toString() to present resource as desired."); 36 | } 37 | else { 38 | if (aResource == null) { 39 | out.write("null"); 40 | } 41 | else { 42 | out.write("" + aResource.getAbout() + ""); 43 | } 44 | } 45 | %> 46 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/com/sample/rm/selectiondialog.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | 3 | <%-- 4 | Copyright (c) 2020 Contributors to the Eclipse Foundation 5 | 6 | See the NOTICE file(s) distributed with this work for additional 7 | information regarding copyright ownership. 8 | 9 | This program and the accompanying materials are made available under the 10 | terms of the Eclipse Distribution License 1.0 which is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: BSD-3-Simple 14 | 15 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 16 | --%> 17 | 18 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 19 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 20 | <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> 21 | 22 | <% 23 | String selectionUri = (String) request.getAttribute("selectionUri"); 24 | String resourceTypeLabel = (String) request.getAttribute("resourceTypeLabel"); 25 | String fieldsToList = (String) request.getAttribute("fieldsToList"); 26 | %> 27 | 28 | 29 | 30 | "> 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/com/sample/rm/serviceprovidercatalog.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | 3 | <%-- 4 | Copyright (c) 2020 Contributors to the Eclipse Foundation 5 | 6 | See the NOTICE file(s) distributed with this work for additional 7 | information regarding copyright ownership. 8 | 9 | This program and the accompanying materials are made available under the 10 | terms of the Eclipse Distribution License 1.0 which is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: BSD-3-Simple 14 | 15 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 16 | --%> 17 | 18 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 19 | <%@ page import="org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog" %> 20 | <%@ page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider" %> 21 | <%@page import="javax.ws.rs.core.UriBuilder"%> 22 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> 23 | 24 | <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> 25 | 26 | <% 27 | ServiceProviderCatalog catalog = (ServiceProviderCatalog)request.getAttribute("catalog"); 28 | String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); 29 | %> 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Service Provider Catalog - RM Tool OSLC Adapter 38 | 39 | 40 | 41 | 42 | 43 | " rel="stylesheet"> 44 | 45 | 46 | 55 | 56 |
57 | 60 | 72 | 73 |

Service Providers

74 | <% if (catalog.getServiceProviders().length == 0) {%> 75 | 83 | <% } %> 84 | <% for (ServiceProvider s : catalog.getServiceProviders()) { %> 85 |
86 |

87 | 88 | <%= s.getTitle() %> 89 | 90 |
91 | 92 | <%= s.getDescription() %> 93 | 94 |

95 |
96 | <% } %> 97 |
98 |
99 |
100 |

101 | OSLC Adaptor was generated using Eclipse Lyo. 102 |

103 |
104 |
105 | 106 | 107 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/com/sample/rm/uipreview.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | 3 | <%-- 4 | Copyright (c) 2020 Contributors to the Eclipse Foundation 5 | 6 | See the NOTICE file(s) distributed with this work for additional 7 | information regarding copyright ownership. 8 | 9 | This program and the accompanying materials are made available under the 10 | terms of the Eclipse Distribution License 1.0 which is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: BSD-3-Simple 14 | 15 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 16 | --%> 17 | 18 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 19 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 20 | 21 | <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> 22 | 23 | <% 24 | String resourceTitle = (String) request.getAttribute("resourceTitle"); 25 | String resourcePreviewDataSet = (String) request.getAttribute("resourcePreviewDataSet"); 26 | %> 27 | 28 | 29 | 30 | 31 | <%= resourceTitle %> 32 | "> 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | 3 | <%-- 4 | Copyright (c) 2022 Contributors to the Eclipse Foundation 5 | 6 | See the NOTICE file(s) distributed with this work for additional 7 | information regarding copyright ownership. 8 | 9 | This program and the accompanying materials are made available under the 10 | terms of the Eclipse Distribution License 1.0 which is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: BSD-3-Simple 14 | 15 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 16 | --%> 17 | 18 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> 19 | <%@page import="javax.ws.rs.core.UriBuilder"%> 20 | <%@page import="java.net.URI"%> 21 | 22 | <%@ page language="java" contentType="text/html; charset=UTF-8" 23 | pageEncoding="UTF-8"%> 24 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 25 | 26 | 27 | 28 | 29 | 30 | Adaptor home 31 | 32 | 33 | 34 | 35 | 36 | " rel="stylesheet"> 37 | 38 | 39 |
40 |
41 |

<%= application.getServletContextName() %>

42 |

This is a homepage of the RM Tool that was generated using 43 | Eclipse Lyo Toolchain Designer.

44 |
45 |

46 | " role="button">Service Provider 47 | Catalog 48 |

49 |

Start from the Service Provider Catalog, to navigate your adaptor's services and resources, using the available Query capabilities, Selection and Creation Dialogs. 50 | Note that these are end-user HTML pages, which is very useful for debugging your adaptor.

51 |

52 | " role="button">Interactive Swagger UI 53 |

54 |

Use Swagger UI To interact with the adaptor services dedicated for RDF. 55 |

56 |

You can also copy ">this OpenAPI specification document (yaml file) of this adaptor to a ">Swagger Editor to generate client SDK code for a number of languages and platforms. 57 |

58 |
59 |
60 | 61 | 62 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/static/css/adaptor.css: -------------------------------------------------------------------------------- 1 | /* Start of user code "Copyright" 2 | */ 3 | /******************************************************************************* 4 | Copyright (c) 2017 KTH Royal Institute of Technology. 5 | 6 | All rights reserved. This program and the accompanying materials 7 | are made available under the terms of the Eclipse Public License v1.0 8 | and Eclipse Distribution License v. 1.0 which accompanies this distribution. 9 | 10 | The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 11 | and the Eclipse Distribution License is available at 12 | http://www.eclipse.org/org/documents/edl-v10.php. 13 | 14 | Contributors: 15 | 16 | Fr�d�ric Loiret - Switch the template to Bootstrap (519699) 17 | Andrii Berezovskyi - Support for UI Preview (494303) 18 | 19 | This file is generated by org.eclipse.lyo.oslc4j.codegenerator 20 | *******************************************************************************/ 21 | /* End of user code */ 22 | 23 | /* Sticky footer 24 | -------------------------------------------------- */ 25 | html { 26 | position: relative; 27 | min-height: 100%; 28 | } 29 | body { 30 | /* Margin bottom by footer height */ 31 | margin-bottom: 60px; 32 | } 33 | .footer { 34 | position: absolute; 35 | bottom: 0; 36 | width: 100%; 37 | /* Set the fixed height of the footer here */ 38 | height: 60px; 39 | background-color: #f5f5f5; 40 | } 41 | 42 | 43 | /* Custom adaptor CSS 44 | -------------------------------------------------- */ 45 | 46 | body > .container { 47 | padding-top: 20px; 48 | padding-bottom: 10px; 49 | } 50 | .container .text-muted { 51 | margin: 20px 0; 52 | } 53 | 54 | .footer > .container { 55 | padding-right: 15px; 56 | padding-left: 15px; 57 | } 58 | 59 | code { 60 | font-size: 80%; 61 | } 62 | 63 | /* 45/11em are the dialog sizes plus bootstrap margins */ 64 | .popover { 65 | max-width: calc(45em + 30px); 66 | max-height: calc(11em + 50px); 67 | } 68 | 69 | #delegatedUI { 70 | width: 523px; 71 | height: 320px; /*this is selection; creation has 480px*/ 72 | } 73 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/static/dist/oslc-ui/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OSLC/lyo-adaptor-sample-modelling/3a129755b78ec9f38a622fd084acde2f0e195ce1/adaptor-rm-webapp/src/main/webapp/static/dist/oslc-ui/favicon.ico -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/static/dist/oslc-ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NgAdaptorSesammTool 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /adaptor-rm-webapp/src/main/webapp/static/dist/oslc-ui/runtime-es2015.js: -------------------------------------------------------------------------------- 1 | !function(e){function r(r){for(var n,l,f=r[0],i=r[1],p=r[2],c=0,s=[];c 2 | 3 | <%-- 4 | Copyright (c) 2020 Contributors to the Eclipse Foundation 5 | 6 | See the NOTICE file(s) distributed with this work for additional 7 | information regarding copyright ownership. 8 | 9 | This program and the accompanying materials are made available under the 10 | terms of the Eclipse Distribution License 1.0 which is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: BSD-3-Simple 14 | 15 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 16 | --%> 17 | 18 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> 19 | <%@page import="javax.ws.rs.core.UriBuilder"%> 20 | <%@page import="java.net.URI"%> 21 | <%@page import="java.io.File"%> 22 | 23 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 24 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 25 | <% 26 | URI yamlPath = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/openapi.yaml").build(); 27 | %> 28 | 29 | 30 | 31 | 32 | Swagger UI 33 | 34 | 35 | 36 | 57 | 58 | 59 |
60 | 61 | 62 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /overlays/ 3 | /.settings/ 4 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | adaptor-testing-webapp 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.jdt.core.javanature 33 | org.eclipse.m2e.core.maven2Nature 34 | org.eclipse.wst.common.project.facet.core.nature 35 | org.eclipse.wst.jsdt.core.jsNature 36 | 37 | 38 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | ## Getting started 4 | 5 | Run the adaptor as a regular web application: 6 | 7 | mvn clean jetty:run-exploded 8 | 9 | 10 | You can then explore the server starting with its [front page on localhost:8082](http://localhost:8082/adaptor-testing/) where you can navigate through its HTML pages, or access its Swagger interface. 11 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/Backend.java: -------------------------------------------------------------------------------- 1 | package com.sample.testing; 2 | 3 | import javax.inject.Inject; 4 | import javax.servlet.http.HttpServletRequest; 5 | import java.util.ArrayList; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import com.sample.testing.clients.RequirementsAdaptorClient; 9 | import com.sample.testing.resources.TestScript; 10 | 11 | import org.eclipse.lyo.oslc4j.core.model.Link; 12 | import java.net.URI; 13 | import java.net.URISyntaxException; 14 | import java.util.Map; 15 | import java.util.concurrent.ThreadLocalRandom; 16 | import java.util.HashMap; 17 | import java.util.List; 18 | 19 | public class Backend { 20 | 21 | private static final Logger log = LoggerFactory.getLogger(Backend.class); 22 | 23 | @Inject ResourcesFactory resourcesFactory; 24 | 25 | public Backend() { 26 | log.trace("Backend is initialized"); 27 | } 28 | 29 | 30 | public int randomNumber(int origin, int bound) { 31 | return ThreadLocalRandom.current().nextInt(origin, bound); 32 | } 33 | 34 | public Link queryForRandomRequirementLink() throws URISyntaxException { 35 | try { 36 | String[] requirements = RequirementsAdaptorClient.queryRequirements(); 37 | int index = randomNumber(0, requirements.length); 38 | return new Link (new URI (requirements[index])); 39 | } catch (Exception e) { 40 | log.error("Failed to query resources", e); 41 | return null; 42 | } 43 | } 44 | 45 | public TestScript createRandomTestScript(String id) { 46 | TestScript r = null; 47 | try { 48 | r = resourcesFactory.createTestScript(id); 49 | r.setTitle("A sample TestScript with id:" + id); 50 | r.setDescription("A sample TestScript with id:" + id); 51 | int size = randomNumber(1, 3); 52 | for (int i = 0; i < size; i++) { 53 | r.addValidatesRequirement(queryForRandomRequirementLink()); 54 | } 55 | } catch (URISyntaxException e) { 56 | log.error("Failed to create resource", e); 57 | } 58 | return r; 59 | } 60 | 61 | public List createRandomTestScripts(String serviceProviderId, int min, int max, int minId, int maxId) { 62 | int size = randomNumber(min, max); 63 | List resources = new ArrayList(size); 64 | for (int i = 0; i < size; i++) { 65 | resources.add(createRandomTestScript(Integer.toString(randomNumber(minId, maxId)))); 66 | } 67 | return resources; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/ResourcesFactory.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2017 Jad El-khoury. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Jad El-khoury - initial implementation 16 | * 17 | *******************************************************************************/ 18 | // End of user code 19 | 20 | package com.sample.testing; 21 | 22 | 23 | import java.net.URI; 24 | import java.net.URISyntaxException; 25 | import java.util.HashMap; 26 | import java.util.Map; 27 | import javax.ws.rs.core.UriBuilder; 28 | 29 | import org.eclipse.lyo.oslc4j.core.model.Link; 30 | import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; 31 | import com.sample.testing.resources.Requirement; 32 | import com.sample.testing.resources.TestScript; 33 | 34 | // Start of user code imports 35 | // End of user code 36 | 37 | // Start of user code pre_class_code 38 | // End of user code 39 | 40 | public class ResourcesFactory { 41 | 42 | private String basePath; 43 | 44 | // Start of user code class_attributes 45 | // End of user code 46 | 47 | public ResourcesFactory(String basePath) { 48 | this.basePath = basePath; 49 | } 50 | 51 | // Start of user code class_methods 52 | // End of user code 53 | 54 | //methods for TestScript resource 55 | 56 | public TestScript createTestScript(final String testScriptId) { 57 | return new TestScript(constructURIForTestScript(testScriptId)); 58 | } 59 | 60 | public URI constructURIForTestScript(final String testScriptId) { 61 | Map pathParameters = new HashMap(); 62 | pathParameters.put("testScriptId", testScriptId); 63 | String instanceURI = "testScripts/{testScriptId}"; 64 | 65 | final UriBuilder builder = UriBuilder.fromUri(this.basePath); 66 | return builder.path(instanceURI).buildFromMap(pathParameters); 67 | } 68 | 69 | public Link constructLinkForTestScript(final String testScriptId , final String label) { 70 | return new Link(constructURIForTestScript(testScriptId), label); 71 | } 72 | 73 | public Link constructLinkForTestScript(final String testScriptId) { 74 | return new Link(constructURIForTestScript(testScriptId)); 75 | } 76 | 77 | 78 | } 79 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/ServerConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /* 3 | * Copyright (c) 2020 Contributors to the Eclipse Foundation 4 | * 5 | * See the NOTICE file(s) distributed with this work for additional 6 | * information regarding copyright ownership. 7 | * 8 | * This program and the accompanying materials are made available under the 9 | * terms of the Eclipse Distribution License 1.0 which is available at 10 | * http://www.eclipse.org/org/documents/edl-v10.php. 11 | * 12 | * SPDX-License-Identifier: BSD-3-Simple 13 | * 14 | * This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 15 | */ 16 | // End of user code 17 | 18 | package com.sample.testing; 19 | 20 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 21 | 22 | // Start of user code imports 23 | // End of user code 24 | 25 | public interface ServerConstants 26 | { 27 | // Start of user code user constants 28 | // End of user code 29 | 30 | public static final String HDR_OSLC_VERSION = "OSLC-Core-Version"; 31 | public static final String OSLC_VERSION_V2 = "2.0"; 32 | } 33 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/ServiceProviderInfo.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2014 Jad El-khoury. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 16 | * 17 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 18 | *******************************************************************************/ 19 | // End of user code 20 | 21 | package com.sample.testing; 22 | 23 | // Start of user code imports 24 | // End of user code 25 | 26 | // Start of user code pre_class_code 27 | // End of user code 28 | public class ServiceProviderInfo { 29 | public String name; 30 | public String serviceProviderId; 31 | 32 | // Start of user code class_attributes 33 | // End of user code 34 | 35 | // Start of user code class_methods 36 | // End of user code 37 | } 38 | 39 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/TestingToolConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.testing; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | // Start of user code imports 31 | // End of user code 32 | 33 | public interface TestingToolConstants 34 | { 35 | // Start of user code user constants 36 | // End of user code 37 | 38 | public static final String HDR_OSLC_VERSION = "OSLC-Core-Version"; 39 | public static final String OSLC_VERSION_V2 = "2.0"; 40 | } 41 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/clients/RequirementsAdaptorClient.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2015 Jad El-khoury. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Jad El-khoury - initial implementation of client code 16 | * 17 | *******************************************************************************/ 18 | // End of user code 19 | 20 | package com.sample.testing.clients; 21 | 22 | import javax.ws.rs.core.Response; 23 | import org.eclipse.lyo.client.OSLCConstants; 24 | import org.eclipse.lyo.client.OslcClient; 25 | import org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog; 26 | import com.sample.testing.resources.Requirement; 27 | 28 | // Start of user code imports 29 | import java.net.URI; 30 | 31 | import org.eclipse.lyo.oslc4j.core.model.ServiceProvider; 32 | import org.eclipse.lyo.client.query.OslcQuery; 33 | import org.eclipse.lyo.client.query.OslcQueryParameters; 34 | import org.eclipse.lyo.client.query.OslcQueryResult; 35 | 36 | import com.sample.testing.resources.Oslc_rmDomainConstants; 37 | // End of user code 38 | 39 | 40 | // Start of user code pre_class_code 41 | // End of user code 42 | 43 | public class RequirementsAdaptorClient 44 | { 45 | 46 | // Start of user code class_attributes 47 | // End of user code 48 | 49 | // Start of user code class_methods 50 | public static String[] queryRequirements() throws Exception 51 | { 52 | OslcClient client = new OslcClient(); 53 | Response response = null; 54 | ServiceProviderCatalog catalog = null; 55 | 56 | //Get the SPC 57 | response = client.getResource(serviceProviderCatalogURI, OSLCConstants.CT_RDF); 58 | if (response != null) { 59 | catalog = response.readEntity(ServiceProviderCatalog.class); 60 | } 61 | 62 | //Get first SP. 63 | ServiceProvider sp = catalog.getServiceProviders()[0]; 64 | 65 | //Find the QCBase that deals with SecondOT 66 | String queryBaseUri = client.lookupQueryCapability(sp.getAbout().toString(), Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_DOMAIN, Oslc_rmDomainConstants.REQUIREMENT_TYPE); 67 | URI queryBase = new URI(queryBaseUri); 68 | 69 | String where = ""; 70 | 71 | OslcQueryParameters queryParameters = new OslcQueryParameters(); 72 | queryParameters.setWhere(where); 73 | OslcQuery query = new OslcQuery(client, queryBase.toString(), queryParameters); 74 | OslcQueryResult queryResults = query.submit(); 75 | String[] urls = queryResults.getMembersUrls(); 76 | return urls; 77 | } 78 | // End of user code 79 | 80 | static String serviceProviderCatalogURI = "http://localhost:8083/adaptor-rm/services/catalog/singleton"; 81 | 82 | public static ServiceProviderCatalog getServiceProviderCatalog() throws Exception { 83 | OslcClient client = new OslcClient(); 84 | Response response = null; 85 | ServiceProviderCatalog catalog = null; 86 | 87 | // Start of user code getServiceProviderCatalog_init 88 | // End of user code 89 | 90 | response = client.getResource(serviceProviderCatalogURI,OSLCConstants.CT_RDF); 91 | if (response != null) { 92 | catalog = response.readEntity(ServiceProviderCatalog.class); 93 | } 94 | // Start of user code getServiceProviderCatalog_final 95 | // End of user code 96 | return catalog; 97 | } 98 | 99 | public static Requirement getRequirement(String resourceURI) throws Exception { 100 | OslcClient client = new OslcClient(); 101 | Response response = null; 102 | Requirement resource = null; 103 | 104 | // Start of user code getRequirement_init 105 | // End of user code 106 | 107 | response = client.getResource(resourceURI, OSLCConstants.CT_RDF); 108 | if (response != null) { 109 | resource = response.readEntity(Requirement.class); 110 | } 111 | // Start of user code getRequirement_final 112 | // End of user code 113 | return resource; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/resources/DctermsDomainConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.testing.resources; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | 31 | // Start of user code imports 32 | // End of user code 33 | 34 | public interface DctermsDomainConstants 35 | { 36 | // Start of user code user constants 37 | // End of user code 38 | 39 | /** 40 | * @deprecated use {@link DctermsDomainConstants#DUBLIN_CORE_NAMSPACE} or {@link DctermsDomainConstants#DUBLIN_CORE_DOMAIN_NAME} instead 41 | */ 42 | @Deprecated(since = "5.0.1") 43 | public static String DUBLIN_CORE_DOMAIN = "http://purl.org/dc/terms/"; 44 | public static String DUBLIN_CORE_DOMAIN_NAME = "Dublin Core"; 45 | public static String DUBLIN_CORE_NAMSPACE = "http://purl.org/dc/terms/"; //Vocabulary namespace for the resources and resource properties, when no explicit vocabulary (describes, or propertyDefinition) is defined 46 | public static String DUBLIN_CORE_NAMSPACE_PREFIX = "dcterms"; //Vocabulary prefix for the resources and resource properties, when no explicit vocabulary (describes, or propertyDefinition) is defined 47 | 48 | } 49 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/resources/FoafDomainConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.testing.resources; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | 31 | // Start of user code imports 32 | // End of user code 33 | 34 | public interface FoafDomainConstants 35 | { 36 | // Start of user code user constants 37 | // End of user code 38 | 39 | public static String FOAF_DOMAIN = "http://xmlns.com/foaf/0.1/"; 40 | public static String FOAF_NAMSPACE = "http://xmlns.com/foaf/0.1/"; 41 | public static String FOAF_NAMSPACE_PREFIX = "foaf"; 42 | 43 | public static String PERSON_PATH = "person"; 44 | public static String PERSON_NAMESPACE = FOAF_NAMSPACE; //namespace of the rdfs:class the resource describes 45 | public static String PERSON_LOCALNAME = "Person"; //localName of the rdfs:class the resource describes 46 | public static String PERSON_TYPE = PERSON_NAMESPACE + PERSON_LOCALNAME; //fullname of the rdfs:class the resource describes 47 | } 48 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/resources/IRequirement.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Sam Padgett - initial API and implementation 20 | * Michael Fiedler - adapted for OSLC4J 21 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 22 | * 23 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 24 | *******************************************************************************/ 25 | // End of user code 26 | 27 | package com.sample.testing.resources; 28 | 29 | import java.net.URI; 30 | import java.net.URISyntaxException; 31 | import java.util.ArrayList; 32 | import java.util.Arrays; 33 | import java.util.Date; 34 | import java.util.HashMap; 35 | import java.util.Map; 36 | import java.text.SimpleDateFormat; 37 | import java.util.HashSet; 38 | import java.util.List; 39 | import java.util.Set; 40 | import java.util.TreeSet; 41 | import java.util.Iterator; 42 | 43 | import org.eclipse.lyo.oslc4j.core.annotation.OslcAllowedValue; 44 | import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription; 45 | import org.eclipse.lyo.oslc4j.core.annotation.OslcMemberProperty; 46 | import org.eclipse.lyo.oslc4j.core.annotation.OslcName; 47 | import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace; 48 | import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs; 49 | import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition; 50 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRdfCollectionType; 51 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRange; 52 | import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly; 53 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRepresentation; 54 | import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape; 55 | import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle; 56 | import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType; 57 | import org.eclipse.lyo.oslc4j.core.model.AbstractResource; 58 | import org.eclipse.lyo.oslc4j.core.model.Link; 59 | import org.eclipse.lyo.oslc4j.core.model.Occurs; 60 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 61 | import org.eclipse.lyo.oslc4j.core.model.Representation; 62 | import org.eclipse.lyo.oslc4j.core.model.ValueType; 63 | 64 | import com.sample.testing.resources.Oslc_rmDomainConstants; 65 | import com.sample.testing.resources.DctermsDomainConstants; 66 | // Start of user code imports 67 | // End of user code 68 | 69 | @OslcNamespace(Oslc_rmDomainConstants.REQUIREMENT_NAMESPACE) 70 | @OslcName(Oslc_rmDomainConstants.REQUIREMENT_LOCALNAME) 71 | @OslcResourceShape(title = "Requirement Shape", describes = Oslc_rmDomainConstants.REQUIREMENT_TYPE) 72 | public interface IRequirement 73 | { 74 | 75 | 76 | @OslcName("identifier") 77 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "identifier") 78 | @OslcOccurs(Occurs.ExactlyOne) 79 | @OslcValueType(ValueType.String) 80 | @OslcReadOnly(false) 81 | public String getIdentifier(); 82 | 83 | @OslcName("title") 84 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "title") 85 | @OslcOccurs(Occurs.ExactlyOne) 86 | @OslcValueType(ValueType.String) 87 | @OslcReadOnly(false) 88 | public String getTitle(); 89 | 90 | @OslcName("description") 91 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "description") 92 | @OslcOccurs(Occurs.ExactlyOne) 93 | @OslcValueType(ValueType.String) 94 | @OslcReadOnly(false) 95 | public String getDescription(); 96 | 97 | 98 | public void setIdentifier(final String identifier ); 99 | public void setTitle(final String title ); 100 | public void setDescription(final String description ); 101 | } 102 | 103 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/resources/ITestScript.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Sam Padgett - initial API and implementation 20 | * Michael Fiedler - adapted for OSLC4J 21 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 22 | * 23 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 24 | *******************************************************************************/ 25 | // End of user code 26 | 27 | package com.sample.testing.resources; 28 | 29 | import java.net.URI; 30 | import java.net.URISyntaxException; 31 | import java.util.ArrayList; 32 | import java.util.Arrays; 33 | import java.util.Date; 34 | import java.util.HashMap; 35 | import java.util.Map; 36 | import java.text.SimpleDateFormat; 37 | import java.util.HashSet; 38 | import java.util.List; 39 | import java.util.Set; 40 | import java.util.TreeSet; 41 | import java.util.Iterator; 42 | 43 | import org.eclipse.lyo.oslc4j.core.annotation.OslcAllowedValue; 44 | import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription; 45 | import org.eclipse.lyo.oslc4j.core.annotation.OslcMemberProperty; 46 | import org.eclipse.lyo.oslc4j.core.annotation.OslcName; 47 | import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace; 48 | import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs; 49 | import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition; 50 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRdfCollectionType; 51 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRange; 52 | import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly; 53 | import org.eclipse.lyo.oslc4j.core.annotation.OslcRepresentation; 54 | import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape; 55 | import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle; 56 | import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType; 57 | import org.eclipse.lyo.oslc4j.core.model.AbstractResource; 58 | import org.eclipse.lyo.oslc4j.core.model.Link; 59 | import org.eclipse.lyo.oslc4j.core.model.Occurs; 60 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 61 | import org.eclipse.lyo.oslc4j.core.model.Representation; 62 | import org.eclipse.lyo.oslc4j.core.model.ValueType; 63 | 64 | import com.sample.testing.resources.Oslc_qmDomainConstants; 65 | import com.sample.testing.resources.DctermsDomainConstants; 66 | import com.sample.testing.resources.Oslc_qmDomainConstants; 67 | import com.sample.testing.resources.Oslc_rmDomainConstants; 68 | import com.sample.testing.resources.IRequirement; 69 | // Start of user code imports 70 | // End of user code 71 | 72 | @OslcNamespace(Oslc_qmDomainConstants.TESTSCRIPT_NAMESPACE) 73 | @OslcName(Oslc_qmDomainConstants.TESTSCRIPT_LOCALNAME) 74 | @OslcResourceShape(title = "TestScript Shape", describes = Oslc_qmDomainConstants.TESTSCRIPT_TYPE) 75 | public interface ITestScript 76 | { 77 | 78 | public void addValidatesRequirement(final Link validatesRequirement ); 79 | 80 | @OslcName("title") 81 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "title") 82 | @OslcOccurs(Occurs.ExactlyOne) 83 | @OslcValueType(ValueType.String) 84 | @OslcReadOnly(false) 85 | public String getTitle(); 86 | 87 | @OslcName("validatesRequirement") 88 | @OslcPropertyDefinition(Oslc_qmDomainConstants.QUALITY_MANAGEMENT_NAMSPACE + "validatesRequirement") 89 | @OslcOccurs(Occurs.ZeroOrMany) 90 | @OslcValueType(ValueType.Resource) 91 | @OslcRange({Oslc_rmDomainConstants.REQUIREMENT_TYPE}) 92 | @OslcReadOnly(false) 93 | public Set getValidatesRequirement(); 94 | 95 | @OslcName("description") 96 | @OslcPropertyDefinition(DctermsDomainConstants.DUBLIN_CORE_NAMSPACE + "description") 97 | @OslcOccurs(Occurs.ExactlyOne) 98 | @OslcValueType(ValueType.String) 99 | @OslcReadOnly(false) 100 | public String getDescription(); 101 | 102 | 103 | public void setTitle(final String title ); 104 | public void setValidatesRequirement(final Set validatesRequirement ); 105 | public void setDescription(final String description ); 106 | } 107 | 108 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/resources/Oslc_qmDomainConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.testing.resources; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | 31 | // Start of user code imports 32 | // End of user code 33 | 34 | public interface Oslc_qmDomainConstants 35 | { 36 | // Start of user code user constants 37 | // End of user code 38 | 39 | /** 40 | * @deprecated use {@link Oslc_qmDomainConstants#QUALITY_MANAGEMENT_NAMSPACE} or {@link Oslc_qmDomainConstants#QUALITY_MANAGEMENT_DOMAIN_NAME} instead 41 | */ 42 | @Deprecated(since = "5.0.1") 43 | public static String QUALITY_MANAGEMENT_DOMAIN = "http://open-services.net/ns/qm#"; 44 | public static String QUALITY_MANAGEMENT_DOMAIN_NAME = "Quality Management"; 45 | public static String QUALITY_MANAGEMENT_NAMSPACE = "http://open-services.net/ns/qm#"; //Vocabulary namespace for the resources and resource properties, when no explicit vocabulary (describes, or propertyDefinition) is defined 46 | public static String QUALITY_MANAGEMENT_NAMSPACE_PREFIX = "oslc_qm"; //Vocabulary prefix for the resources and resource properties, when no explicit vocabulary (describes, or propertyDefinition) is defined 47 | 48 | public static String TESTCASE_PATH = "testCase"; //the relative path of the resource shape URL. 49 | public static String TESTCASE_NAMESPACE = Oslc_qmDomainConstants.QUALITY_MANAGEMENT_NAMSPACE; //namespace of the rdfs:class the resource describes 50 | public static String TESTCASE_LOCALNAME = "TestCase"; //localName of the rdfs:class the resource describes 51 | public static String TESTCASE_TYPE = TESTCASE_NAMESPACE + TESTCASE_LOCALNAME; //fullname of the rdfs:class the resource describes 52 | public static String TESTPLAN_PATH = "testPlan"; //the relative path of the resource shape URL. 53 | public static String TESTPLAN_NAMESPACE = Oslc_qmDomainConstants.QUALITY_MANAGEMENT_NAMSPACE; //namespace of the rdfs:class the resource describes 54 | public static String TESTPLAN_LOCALNAME = "TestPlan"; //localName of the rdfs:class the resource describes 55 | public static String TESTPLAN_TYPE = TESTPLAN_NAMESPACE + TESTPLAN_LOCALNAME; //fullname of the rdfs:class the resource describes 56 | public static String TESTSCRIPT_PATH = "testScript"; //the relative path of the resource shape URL. 57 | public static String TESTSCRIPT_NAMESPACE = Oslc_qmDomainConstants.QUALITY_MANAGEMENT_NAMSPACE; //namespace of the rdfs:class the resource describes 58 | public static String TESTSCRIPT_LOCALNAME = "TestScript"; //localName of the rdfs:class the resource describes 59 | public static String TESTSCRIPT_TYPE = TESTSCRIPT_NAMESPACE + TESTSCRIPT_LOCALNAME; //fullname of the rdfs:class the resource describes 60 | } 61 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/resources/Oslc_rmDomainConstants.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Michael Fiedler - Bugzilla adpater implementations 20 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 21 | * 22 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 23 | *******************************************************************************/ 24 | // End of user code 25 | 26 | package com.sample.testing.resources; 27 | 28 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 29 | 30 | 31 | // Start of user code imports 32 | // End of user code 33 | 34 | public interface Oslc_rmDomainConstants 35 | { 36 | // Start of user code user constants 37 | // End of user code 38 | 39 | /** 40 | * @deprecated use {@link Oslc_rmDomainConstants#REQUIREMENTS_MANAGEMENT_NAMSPACE} or {@link Oslc_rmDomainConstants#REQUIREMENTS_MANAGEMENT_DOMAIN_NAME} instead 41 | */ 42 | @Deprecated(since = "5.0.1") 43 | public static String REQUIREMENTS_MANAGEMENT_DOMAIN = "http://open-services.net/ns/rm#"; 44 | public static String REQUIREMENTS_MANAGEMENT_DOMAIN_NAME = "Requirements Management"; 45 | public static String REQUIREMENTS_MANAGEMENT_NAMSPACE = "http://open-services.net/ns/rm#"; //Vocabulary namespace for the resources and resource properties, when no explicit vocabulary (describes, or propertyDefinition) is defined 46 | public static String REQUIREMENTS_MANAGEMENT_NAMSPACE_PREFIX = "oslc_rm"; //Vocabulary prefix for the resources and resource properties, when no explicit vocabulary (describes, or propertyDefinition) is defined 47 | 48 | public static String REQUIREMENT_PATH = "requirement"; //the relative path of the resource shape URL. 49 | public static String REQUIREMENT_NAMESPACE = Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_NAMSPACE; //namespace of the rdfs:class the resource describes 50 | public static String REQUIREMENT_LOCALNAME = "Requirement"; //localName of the rdfs:class the resource describes 51 | public static String REQUIREMENT_TYPE = REQUIREMENT_NAMESPACE + REQUIREMENT_LOCALNAME; //fullname of the rdfs:class the resource describes 52 | } 53 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/resources/package-info.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /******************************************************************************* 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * 5 | * All rights reserved. This program and the accompanying materials 6 | * are made available under the terms of the Eclipse Public License v1.0 7 | * and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | * 9 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | * and the Eclipse Distribution License is available at 11 | * http://www.eclipse.org/org/documents/edl-v10.php. 12 | * 13 | * Contributors: 14 | * 15 | * Russell Boykin - initial API and implementation 16 | * Alberto Giammaria - initial API and implementation 17 | * Chris Peters - initial API and implementation 18 | * Gianluca Bernardini - initial API and implementation 19 | * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) 20 | * 21 | * This file is generated by org.eclipse.lyo.oslc4j.codegenerator 22 | *******************************************************************************/ 23 | // End of user code 24 | 25 | @OslcSchema ({ 26 | @OslcNamespaceDefinition(prefix = OslcConstants.DCTERMS_NAMESPACE_PREFIX, namespaceURI = OslcConstants.DCTERMS_NAMESPACE), 27 | @OslcNamespaceDefinition(prefix = OslcConstants.OSLC_CORE_NAMESPACE_PREFIX, namespaceURI = OslcConstants.OSLC_CORE_NAMESPACE), 28 | @OslcNamespaceDefinition(prefix = OslcConstants.OSLC_DATA_NAMESPACE_PREFIX, namespaceURI = OslcConstants.OSLC_DATA_NAMESPACE), 29 | @OslcNamespaceDefinition(prefix = OslcConstants.RDF_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDF_NAMESPACE), 30 | @OslcNamespaceDefinition(prefix = OslcConstants.RDFS_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDFS_NAMESPACE), 31 | @OslcNamespaceDefinition(prefix = Oslc_qmDomainConstants.QUALITY_MANAGEMENT_NAMSPACE_PREFIX, namespaceURI = Oslc_qmDomainConstants.QUALITY_MANAGEMENT_NAMSPACE), 32 | @OslcNamespaceDefinition(prefix = Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_NAMSPACE_PREFIX, namespaceURI = Oslc_rmDomainConstants.REQUIREMENTS_MANAGEMENT_NAMSPACE), 33 | }) 34 | package com.sample.testing.resources; 35 | 36 | import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespaceDefinition; 37 | import org.eclipse.lyo.oslc4j.core.annotation.OslcSchema; 38 | import org.eclipse.lyo.oslc4j.core.model.OslcConstants; 39 | import com.sample.testing.resources.Oslc_qmDomainConstants; 40 | import com.sample.testing.resources.Oslc_rmDomainConstants; 41 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/java/com/sample/testing/servlet/ApplicationBinder.java: -------------------------------------------------------------------------------- 1 | // Start of user code Copyright 2 | /* 3 | * Copyright (c) 2020 Contributors to the Eclipse Foundation 4 | * 5 | * See the NOTICE file(s) distributed with this work for additional 6 | * information regarding copyright ownership. 7 | * 8 | * This program and the accompanying materials are made available under the 9 | * terms of the Eclipse Distribution License 1.0 which is available at 10 | * http://www.eclipse.org/org/documents/edl-v10.php. 11 | * 12 | * SPDX-License-Identifier: BSD-3-Simple 13 | * 14 | * This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 15 | */ 16 | // End of user code 17 | 18 | package com.sample.testing.servlet; 19 | 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | import org.glassfish.hk2.api.Factory; 23 | import org.glassfish.hk2.utilities.binding.AbstractBinder; 24 | 25 | import javax.inject.Singleton; 26 | 27 | import com.sample.testing.RestDelegate; 28 | import com.sample.testing.ResourcesFactory; 29 | 30 | import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; 31 | // Start of user code imports 32 | import com.sample.testing.Backend; 33 | // End of user code 34 | 35 | // Start of user code pre_class_code 36 | // End of user code 37 | 38 | public class ApplicationBinder extends AbstractBinder { 39 | 40 | private static final Logger log = LoggerFactory.getLogger(ApplicationBinder.class); 41 | 42 | // Start of user code class_attributes 43 | // End of user code 44 | 45 | // Start of user code class_methods 46 | // End of user code 47 | 48 | public ApplicationBinder() 49 | { 50 | log.info("HK2 contract binding init"); 51 | } 52 | 53 | @Override 54 | protected void configure() { 55 | log.info("HK2 contract binding start"); 56 | 57 | // Start of user code ConfigureInitialise 58 | bindAsContract(Backend.class).in(Singleton.class); 59 | // End of user code 60 | bindAsContract(RestDelegate.class).in(Singleton.class); 61 | bindFactory(ResourcesFactoryFactory.class).to(ResourcesFactory.class).in(Singleton.class); 62 | 63 | 64 | 65 | // Start of user code ConfigureFinalize 66 | // End of user code 67 | } 68 | static class ResourcesFactoryFactory implements Factory { 69 | @Override 70 | public ResourcesFactory provide() { 71 | return new ResourcesFactory(OSLC4JUtils.getServletURI()); 72 | } 73 | 74 | @Override 75 | public void dispose(ResourcesFactory instance) { 76 | } 77 | } 78 | 79 | 80 | } 81 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # https://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html 2 | # Must be one of ("trace", "debug", "info", "warn", "error" or "off"). 3 | # If not specified, defaults to "info". 4 | org.slf4j.simpleLogger.logFile = System.out 5 | org.slf4j.simpleLogger.showLogName = true 6 | org.slf4j.simpleLogger.showDateTime = true 7 | org.slf4j.simpleLogger.levelInBrackets = true 8 | 9 | org.slf4j.simpleLogger.defaultLogLevel = TRACE 10 | org.slf4j.simpleLogger.showThreadName = false 11 | org.slf4j.simpleLogger.dateTimeFormat = HH:mm:ss.SSS 12 | org.slf4j.simpleLogger.showShortLogName = false 13 | 14 | #org.slf4j.simpleLogger.log.org.eclipse.lyo = TRACE 15 | #org.slf4j.simpleLogger.log.org.eclipse.lyo.trs = TRACE 16 | #org.slf4j.simpleLogger.log.org.apache.wink.internal = INFO 17 | #org.slf4j.simpleLogger.log.org.apache.wink.common.internal= INFO 18 | #org.slf4j.simpleLogger.log.org.apache.wink.server.internal= INFO 19 | #org.slf4j.simpleLogger.log.org.apache.wink.server.internal.log.Providers= WARN 20 | # 21 | org.slf4j.simpleLogger.log.org.apache.jena = INFO 22 | #org.slf4j.simpleLogger.log.org.apache.http = INFO 23 | #org.slf4j.simpleLogger.log.Jena = INFO 24 | #org.slf4j.simpleLogger.log.org.jboss.weld = TRACE 25 | # 26 | #org.slf4j.simpleLogger.log.org.eclipse.paho.client.mqttv3 = INFO 27 | 28 | #org.slf4j.simpleLogger.log.com.spotify.docker.client.shaded = INFO 29 | #org.slf4j.simpleLogger.log.com.hazelcast = INFO 30 | #org.slf4j.simpleLogger.log.org.bitsofinfo.hazelcast.discovery = WARN 31 | #org.slf4j.simpleLogger.log.eu.scott.warehouse.lib.LoggingMqttCallback = INFO 32 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | Testing Tool 7 | 8 | Base URI for the adaptor. 9 | com.sample.testing.servlet.baseurl 10 | http://localhost:8082/ 11 | 13 | 14 | 16 | 17 | 19 | 20 | 22 | 23 | Listener for ServletContext lifecycle changes 24 | com.sample.testing.servlet.ServletListener 25 | 26 | 28 | 29 | 31 | 32 | JAX-RS Servlet 33 | org.glassfish.jersey.servlet.ServletContainer 34 | 35 | javax.ws.rs.Application 36 | com.sample.testing.servlet.Application 37 | 38 | 1 39 | 40 | 42 | 43 | 45 | 46 | JAX-RS Servlet 47 | /services/* 48 | 49 | 51 | 52 | 54 | 55 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/com/sample/testing/creationdialogsampleclient.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | 4 | <%-- 5 | Copyright (c) 2020 Contributors to the Eclipse Foundation 6 | 7 | See the NOTICE file(s) distributed with this work for additional 8 | information regarding copyright ownership. 9 | 10 | This program and the accompanying materials are made available under the 11 | terms of the Eclipse Distribution License 1.0 which is available at 12 | http://www.eclipse.org/org/documents/edl-v10.php. 13 | 14 | SPDX-License-Identifier: BSD-3-Simple 15 | 16 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 17 | --%> 18 | 19 | <%@page import="javax.ws.rs.core.UriBuilder"%> 20 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> 21 | <%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider" %> 22 | <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> 23 | <% 24 | String creationDialogUri = request.getParameter("creationUri"); 25 | creationDialogUri += "#oslc-core-postMessage-1.0"; 26 | String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); 27 | %> 28 | 29 | 30 | Creation Dialog client 31 | 32 | " rel="stylesheet"> 33 | " rel="stylesheet"> 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 52 | 53 |
54 | 55 | 59 | 60 |
61 |
62 |
63 |
Creation Dialog iframe for:
64 | 67 |
68 | 69 |
70 |
71 |
72 |
73 | 74 |
75 |
76 |
77 |
Creation Dialog results
78 |
79 |
    80 |
    81 |
    82 |
    83 |
    84 | 85 |
    86 | 87 |
    88 |
    89 |

    90 | OSLC Adaptor was generated using Eclipse Lyo. 91 |

    92 |
    93 |
    94 | 95 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/com/sample/testing/requirementtohtml.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | <%-- 3 | Copyright (c) 2020 Contributors to the Eclipse Foundation 4 | 5 | See the NOTICE file(s) distributed with this work for additional 6 | information regarding copyright ownership. 7 | 8 | This program and the accompanying materials are made available under the 9 | terms of the Eclipse Distribution License 1.0 which is available at 10 | http://www.eclipse.org/org/documents/edl-v10.php. 11 | 12 | SPDX-License-Identifier: BSD-3-Simple 13 | 14 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 15 | --%> 16 | 17 | <%@page import="com.sample.testing.resources.Requirement"%> 18 | <%@page import="java.net.URI"%> 19 | <% 20 | String asLocalResource = request.getParameter("asLocalResource"); 21 | Requirement aResource = null; 22 | if (request.getParameter("resourceUri") != null) { 23 | aResource = new Requirement (new URI(request.getParameter("resourceUri"))); 24 | } 25 | else { 26 | if (request.getAttribute("aRequirement") != null) { 27 | aResource = (Requirement) request.getAttribute("aRequirement"); 28 | } 29 | } 30 | 31 | if (asLocalResource != null && asLocalResource.equalsIgnoreCase("true")) { 32 | out.write("{a Local Requirement Resource} - update Requirement.toString() to present resource as desired."); 33 | } 34 | else { 35 | if (aResource == null) { 36 | out.write("null"); 37 | } 38 | else { 39 | out.write("" + aResource.getAbout() + ""); 40 | } 41 | } 42 | %> 43 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/com/sample/testing/selectiondialogsampleclient.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | 4 | <%-- 5 | Copyright (c) 2020 Contributors to the Eclipse Foundation 6 | 7 | See the NOTICE file(s) distributed with this work for additional 8 | information regarding copyright ownership. 9 | 10 | This program and the accompanying materials are made available under the 11 | terms of the Eclipse Distribution License 1.0 which is available at 12 | http://www.eclipse.org/org/documents/edl-v10.php. 13 | 14 | SPDX-License-Identifier: BSD-3-Simple 15 | 16 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 17 | --%> 18 | 19 | <%@page import="javax.ws.rs.core.UriBuilder"%> 20 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> 21 | <%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider" %> 22 | <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> 23 | <% 24 | String selectionDialogUri = request.getParameter("selectionUri"); 25 | selectionDialogUri += "#oslc-core-postMessage-1.0"; 26 | String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); 27 | %> 28 | 29 | 30 | Selection Dialog sample client 31 | " rel="stylesheet"> 32 | " rel="stylesheet"> 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 51 | 52 |
    53 | 54 | 58 | 59 |
    60 |
    61 |
    62 |
    Selection Dialog iframe for:
    63 | 66 |
    67 | 68 |
    69 |
    70 |
    71 |
    72 | 73 |
    74 |
    75 |
    76 |
    Selection Dialog results
    77 |
    78 |
      79 |
      80 |
      81 |
      82 |
      83 | 84 |
      85 | 86 |
      87 |
      88 |

      89 | OSLC Adaptor was generated using Eclipse Lyo. 90 |

      91 |
      92 |
      93 | 94 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/com/sample/testing/serviceprovidercatalog.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | 3 | <%-- 4 | Copyright (c) 2020 Contributors to the Eclipse Foundation 5 | 6 | See the NOTICE file(s) distributed with this work for additional 7 | information regarding copyright ownership. 8 | 9 | This program and the accompanying materials are made available under the 10 | terms of the Eclipse Distribution License 1.0 which is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: BSD-3-Simple 14 | 15 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 16 | --%> 17 | 18 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 19 | <%@ page import="org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog" %> 20 | <%@ page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider" %> 21 | <%@page import="javax.ws.rs.core.UriBuilder"%> 22 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> 23 | 24 | <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> 25 | 26 | <% 27 | ServiceProviderCatalog catalog = (ServiceProviderCatalog)request.getAttribute("catalog"); 28 | String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); 29 | %> 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Service Provider Catalog - Testing Tool OSLC Adapter 38 | 39 | " rel="stylesheet"> 40 | " rel="stylesheet"> 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 57 | 58 |
      59 | 62 | 74 |

      Service Providers

      75 | <% if (catalog.getServiceProviders().length == 0) {%> 76 | 84 | <% } %> 85 | <% for (ServiceProvider s : catalog.getServiceProviders()) { %> 86 |
      87 |

      88 | 89 | <%= s.getTitle() %> 90 | 91 |
      92 | 93 | <%= s.getDescription() %> 94 | 95 |

      96 |
      97 | <% } %> 98 |
      99 |
      100 |
      101 |

      102 | OSLC Adaptor was generated using Eclipse Lyo. 103 |

      104 |
      105 |
      106 | 107 | 108 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/com/sample/testing/testscriptscollection.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | 3 | <%-- 4 | Copyright (c) 2020 Contributors to the Eclipse Foundation 5 | 6 | See the NOTICE file(s) distributed with this work for additional 7 | information regarding copyright ownership. 8 | 9 | This program and the accompanying materials are made available under the 10 | terms of the Eclipse Distribution License 1.0 which is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: BSD-3-Simple 14 | 15 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 16 | --%> 17 | 18 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 19 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 20 | 21 | <%@page import="javax.ws.rs.core.UriBuilder"%> 22 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> 23 | <%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%> 24 | <%@page import="org.eclipse.lyo.oslc4j.core.model.AbstractResource"%> 25 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JConstants"%> 26 | <%@page import="java.util.List" %> 27 | 28 | <%@page import="com.sample.testing.resources.TestScript"%> 29 | <%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %> 30 | <% 31 | List resources = (List) request.getAttribute("resources"); 32 | String queryUri = (String)request.getAttribute("queryUri"); 33 | String nextPageUri = (String)request.getAttribute(OSLC4JConstants.OSLC4J_NEXT_PAGE); 34 | String catalogUrl = UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("/catalog/singleton").build().toString(); 35 | %> 36 | 37 | 38 | 39 | 40 | 41 | Query capability QueryCapability 42 | 43 | " rel="stylesheet"> 44 | " rel="stylesheet"> 45 | 46 | 47 | 48 | 49 | 50 | 53 | 54 | 55 | 56 | 57 | 66 | 67 |
      68 | 76 | 88 | <% for (TestScript aResource : resources) { %> 89 |

      <%=aResource.toString()%>

      90 | <% } %> 91 |
      92 |
      93 |
      94 |

      OSLC Adaptor was generated using Eclipse Lyo.

      95 |
      96 |
      97 | 98 | 99 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/com/sample/testing/testscripttohtml.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | <%-- 3 | Copyright (c) 2020 Contributors to the Eclipse Foundation 4 | 5 | See the NOTICE file(s) distributed with this work for additional 6 | information regarding copyright ownership. 7 | 8 | This program and the accompanying materials are made available under the 9 | terms of the Eclipse Distribution License 1.0 which is available at 10 | http://www.eclipse.org/org/documents/edl-v10.php. 11 | 12 | SPDX-License-Identifier: BSD-3-Simple 13 | 14 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 15 | --%> 16 | 17 | <%@page import="com.sample.testing.resources.TestScript"%> 18 | <%@page import="java.net.URI"%> 19 | <% 20 | String asLocalResource = request.getParameter("asLocalResource"); 21 | TestScript aResource = null; 22 | if (request.getParameter("resourceUri") != null) { 23 | aResource = new TestScript (new URI(request.getParameter("resourceUri"))); 24 | } 25 | else { 26 | if (request.getAttribute("aTestScript") != null) { 27 | aResource = (TestScript) request.getAttribute("aTestScript"); 28 | } 29 | } 30 | 31 | if (asLocalResource != null && asLocalResource.equalsIgnoreCase("true")) { 32 | out.write("{a Local TestScript Resource} - update TestScript.toString() to present resource as desired."); 33 | } 34 | else { 35 | if (aResource == null) { 36 | out.write("null"); 37 | } 38 | else { 39 | out.write("" + aResource.getAbout() + ""); 40 | } 41 | } 42 | %> 43 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%--To avoid the overriding of any manual code changes upon subsequent code generations, disable "Generate JSP Files" option in the Adaptor model.--%> 2 | 3 | <%-- 4 | Copyright (c) 2020 Contributors to the Eclipse Foundation 5 | 6 | See the NOTICE file(s) distributed with this work for additional 7 | information regarding copyright ownership. 8 | 9 | This program and the accompanying materials are made available under the 10 | terms of the Eclipse Distribution License 1.0 which is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | SPDX-License-Identifier: BSD-3-Simple 14 | 15 | This file is generated by Lyo Designer (https://www.eclipse.org/lyo/) 16 | --%> 17 | 18 | <%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%> 19 | <%@page import="javax.ws.rs.core.UriBuilder"%> 20 | <%@page import="java.net.URI"%> 21 | 22 | <%@ page language="java" contentType="text/html; charset=UTF-8" 23 | pageEncoding="UTF-8"%> 24 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 25 | 26 | 27 | 28 | 29 | 30 | Adaptor home 31 | 32 | " rel="stylesheet"> 33 | " rel="stylesheet"> 34 | 35 | 36 | 37 | 38 | 39 |
      40 |
      41 |

      <%= application.getServletContextName() %>

      42 |

      This is a homepage of the Testing Tool that was generated using 43 | Eclipse Lyo Toolchain Designer.

      44 |
      45 |

      46 | " role="button">Service Provider 47 | Catalog 48 |

      49 |

      Start from the Service Provider Catalog, to navigate your adaptor's services and resources, using the available Query capabilities, Selection and Creation Dialogs. 50 | Note that these are end-user HTML pages, which is very useful for debugging your adaptor.

      51 |

      52 | " role="button">Interactive Swagger UI 53 |

      54 |

      Use Swagger UI To interact with the adaptor services dedicated for RDF. 55 |

      56 |

      You can also copy ">this OpenAPI specification document (yaml file) of this adaptor to a ">Swagger Editor to generate client SDK code for a number of languages and platforms. 57 |

      58 |
      59 |
      60 | 61 | 62 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/static/css/adaptor.css: -------------------------------------------------------------------------------- 1 | /* Start of user code "Copyright" 2 | */ 3 | /******************************************************************************* 4 | Copyright (c) 2017 KTH Royal Institute of Technology. 5 | 6 | All rights reserved. This program and the accompanying materials 7 | are made available under the terms of the Eclipse Public License v1.0 8 | and Eclipse Distribution License v. 1.0 which accompanies this distribution. 9 | 10 | The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 11 | and the Eclipse Distribution License is available at 12 | http://www.eclipse.org/org/documents/edl-v10.php. 13 | 14 | Contributors: 15 | 16 | Fr�d�ric Loiret - Switch the template to Bootstrap (519699) 17 | Andrii Berezovskyi - Support for UI Preview (494303) 18 | 19 | This file is generated by org.eclipse.lyo.oslc4j.codegenerator 20 | *******************************************************************************/ 21 | /* End of user code */ 22 | 23 | /* Sticky footer 24 | -------------------------------------------------- */ 25 | html { 26 | position: relative; 27 | min-height: 100%; 28 | } 29 | body { 30 | /* Margin bottom by footer height */ 31 | margin-bottom: 60px; 32 | } 33 | .footer { 34 | position: absolute; 35 | bottom: 0; 36 | width: 100%; 37 | /* Set the fixed height of the footer here */ 38 | height: 60px; 39 | background-color: #f5f5f5; 40 | } 41 | 42 | 43 | /* Custom adaptor CSS 44 | -------------------------------------------------- */ 45 | 46 | body > .container { 47 | padding-top: 20px; 48 | padding-bottom: 10px; 49 | } 50 | .container .text-muted { 51 | margin: 20px 0; 52 | } 53 | 54 | .footer > .container { 55 | padding-right: 15px; 56 | padding-left: 15px; 57 | } 58 | 59 | code { 60 | font-size: 80%; 61 | } 62 | 63 | /* 45/11em are the dialog sizes plus bootstrap margins */ 64 | .popover { 65 | max-width: calc(45em + 30px); 66 | max-height: calc(11em + 50px); 67 | } 68 | 69 | #delegatedUI { 70 | width: 523px; 71 | height: 320px; /*this is selection; creation has 480px*/ 72 | } 73 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/static/js/delegated-ui-helper.js: -------------------------------------------------------------------------------- 1 | // Start of user code "Copyright Header" 2 | /******************************************************************************* 3 | Copyright (c) 2020 KTH Royal Institute of Technology. 4 | 5 | All rights reserved. This program and the accompanying materials 6 | are made available under the terms of the Eclipse Public License v1.0 7 | and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | 9 | The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | 15 | Jad El-khoury - Support for delegatedUI 16 | 17 | This file is generated by org.eclipse.lyo.oslc4j.codegenerator 18 | *******************************************************************************/ 19 | // End of user code 20 | 21 | //register an addEventListener that handles the response form the Selection DelegatedUI iframe to the parent window. 22 | //The function passes the message payload without any processing. 23 | function registerSelectionDUIRawResponseListener(iframeElement, oslcMessageHandler) { 24 | window.addEventListener('message', function (e) { 25 | var HEADER = "oslc-response:"; 26 | if (e.source == iframeElement.contentWindow 27 | && e.data.indexOf(HEADER) == 0) { 28 | var message = e.data; 29 | oslcMessageHandler(message); 30 | } 31 | }, false); 32 | } 33 | 34 | //register an addEventListener that handles the response form the Selection DelegatedUI iframe to the parent window. 35 | //For each of the selected OSLC resource, the function will call oslcSelectionPresentationFunction with the url and label of that resource. 36 | function registerSelectionDUIResponseListener(iframeElement, oslcSelectionPreprocessingFunction, oslcSelectionPresentationFunction) { 37 | window.addEventListener('message', function (e) { 38 | var HEADER = "oslc-response:"; 39 | if (e.source == iframeElement.contentWindow 40 | && e.data.indexOf(HEADER) == 0) { 41 | var message = e.data.slice(HEADER.length); 42 | oslcSelectionPreprocessingFunction(); 43 | var selectedOslcResources = JSON.parse(message)["oslc:results"]; 44 | for (var i = 0; i < selectedOslcResources.length; i++) { 45 | oslcSelectionPresentationFunction(selectedOslcResources[i]["rdf:resource"], selectedOslcResources[i]["oslc:label"]); 46 | } 47 | } 48 | }, false); 49 | } 50 | 51 | //register an addEventListener that handles the response form the Creation DelegatedUI iframe to the parent window. 52 | //For the created OSLC resource, the function will call oslcCreationPresentationFunction with the url and label of that resource. 53 | function registerCreationDUIResponseListener(iframeElement, oslcCreationPreprocessingFunction, oslcCreationPresentationFunction) { 54 | window.addEventListener('message', function (e) { 55 | var HEADER = "oslc-response:"; 56 | if (e.source == iframeElement.contentWindow 57 | && e.data.indexOf(HEADER) == 0) { 58 | var message = e.data.slice(HEADER.length); 59 | oslcCreationPreprocessingFunction(); 60 | var createdOslcResource = JSON.parse(message)["oslc:results"]; 61 | oslcCreationPresentationFunction(createdOslcResource[0]["rdf:resource"], createdOslcResource[0]["oslc:label"]); 62 | } 63 | }, false); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /adaptor-testing-webapp/src/main/webapp/static/js/preview.js: -------------------------------------------------------------------------------- 1 | // Start of user code "Copyright Header" 2 | /******************************************************************************* 3 | Copyright (c) 2017 KTH Royal Institute of Technology. 4 | 5 | All rights reserved. This program and the accompanying materials 6 | are made available under the terms of the Eclipse Public License v1.0 7 | and Eclipse Distribution License v. 1.0 which accompanies this distribution. 8 | 9 | The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 10 | and the Eclipse Distribution License is available at 11 | http://www.eclipse.org/org/documents/edl-v10.php. 12 | 13 | Contributors: 14 | 15 | Fr�d�ric Loiret - Switch the template to Bootstrap (519699) 16 | Andrii Berezovskyi - Support for UI Preview (494303) 17 | 18 | This file is generated by org.eclipse.lyo.oslc4j.codegenerator 19 | *******************************************************************************/ 20 | // End of user code 21 | 22 | /* parse OSLC UI Preview XML into JSON structure with uri, title, h and w */ 23 | function parsePreview(xml) { 24 | var ret = {}; 25 | var compact = firstChild(firstChild(xml)); 26 | 27 | var titleChild = firstChildNamed(compact, 'dcterms:title'); 28 | ret.title = titleChild.textContent; 29 | 30 | var smallPrev = firstChildNamed(compact, 'oslc:smallPreview'); 31 | var largePrev = firstChildNamed(compact, 'oslc:largePreview'); 32 | var preview; 33 | if (smallPrev !== null) { 34 | preview = firstChild(smallPrev); 35 | } else { 36 | preview = firstChild(largePrev); 37 | } 38 | if (preview) { 39 | var document = firstChildNamed(preview, 'oslc:document'); 40 | if (document) ret.uri = document.getAttribute('rdf:resource'); 41 | var height = firstChildNamed(preview, 'oslc:hintHeight'); 42 | ret.height = height.textContent; 43 | var width = firstChildNamed(preview, 'oslc:hintWidth'); 44 | ret.width = width.textContent; 45 | } 46 | return ret; 47 | } 48 | 49 | function firstChild(e) { 50 | for (i = 0; i < e.childNodes.length; i++) { 51 | if (e.childNodes[i].nodeType === Node.ELEMENT_NODE) { 52 | return e.childNodes[i]; 53 | } 54 | } 55 | } 56 | 57 | function firstChildNamed(e, nodeName) { 58 | for (i = 0; i < e.childNodes.length; i++) { 59 | if (e.childNodes[i].nodeType === Node.ELEMENT_NODE 60 | && e.childNodes[i].nodeName === nodeName) { 61 | return e.childNodes[i]; 62 | } 63 | } 64 | } 65 | 66 | $(function () { 67 | 68 | var previewLinks = $("a.oslc-resource-link"); 69 | previewLinks.popover({ 70 | container: "body", 71 | content: "Loading...", 72 | delay: {"show": 120, "hide": 60}, 73 | html: true, 74 | placement: "auto", 75 | trigger: "hover" 76 | }); 77 | 78 | 79 | previewLinks.on("show.bs.popover", function () { 80 | var uiElem = $(this); 81 | var popoverElem = uiElem.data('bs.popover'); 82 | 83 | $.ajax({ 84 | type: "GET", 85 | url: this.getAttribute("href"), 86 | dataType: "xml", 87 | accepts: { 88 | xml: "application/x-oslc-compact+xml" 89 | }, 90 | success: function (data) { 91 | try { 92 | var previewData = parsePreview(data); 93 | var html = "