79 | A sample set of Requirement resources is presented here. Modify the
80 | method
81 | queryRequirements()
82 | in the class
83 | RMToolManager
84 | , to return the expected set of Requirement resources.
85 |
91 |
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 | " type="module">
35 | " nomodule defer>
36 | " nomodule defer>
37 | " type="module">
38 | " type="module">
39 | " nomodule defer>
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 |
58 |
RM Tool Service Provider Catalogue
59 |
60 |
61 |
Sample data!
62 |
63 |
64 | A sample list of Service Providers are listed here. Modify the
65 | method
66 | getServiceProviderInfos()
67 | in the class
68 | RMToolManager
69 | , to return the expected set of ServiceProvider resources.
70 |
71 |
72 |
73 |
Service Providers
74 | <% if (catalog.getServiceProviders().length == 0) {%>
75 |
76 |
No Service Providers defined for this server!
77 |
78 |
79 | Modify the method getServiceProviderInfos()
80 | in the class com.sample.rm.RestDelegate, to return the expected set of Service Provider resources.
81 |
82 |
83 | <% } %>
84 | <% for (ServiceProvider s : catalog.getServiceProviders()) { %>
85 |
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 |
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 |
56 |
Creation Dialog sample client
57 |
Use this sample code (html, javascript) to build your own interactions with OSLC Delegated UIs.
58 |
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 |
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 |
55 |
Selection Dialog sample client
56 |
Use this sample code (html, javascript) to build your own interactions with OSLC Delegated UIs.
57 |
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 |
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 |
60 |
Testing Tool Service Provider Catalogue
61 |
62 |
63 |
Sample data!
64 |
65 |
66 | A sample list of Service Providers are listed here. Modify the
67 | method
68 | getServiceProviderInfos()
69 | in the class
70 | TestingToolManager
71 | , to return the expected set of ServiceProvider resources.
72 |
73 |
74 |
Service Providers
75 | <% if (catalog.getServiceProviders().length == 0) {%>
76 |
77 |
No Service Providers defined for this server!
78 |
79 |
80 | Modify the method getServiceProviderInfos()
81 | in the class com.sample.testing.TestingToolManager, to return the expected set of Service Provider resources.
82 |
83 |
84 | <% } %>
85 | <% for (ServiceProvider s : catalog.getServiceProviders()) { %>
86 |
80 | A sample set of TestScript resource is presented here. Modify the
81 | method
82 | queryTestScripts()
83 | in the class
84 | TestingToolManager
85 | , to return the expected set of TestScript resources.
86 |
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 |
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 = "";
98 |
99 | uiElem.attr('data-original-title', previewData.title);
100 | uiElem.attr('data-content', html);
101 | popoverElem.setContent();
102 | } catch (e) {
103 | uiElem.attr('data-original-title', "Error");
104 | uiElem.attr('data-content', 'Error parsing preview dialog info');
105 | popoverElem.setContent();
106 | }
107 | },
108 | error: function (xhr, status, err) {
109 | uiElem.attr('data-original-title', "Error");
110 | uiElem.attr('data-content', 'Error loading the preview dialog');
111 | popoverElem.setContent();
112 | }
113 | });
114 | })
115 | });
116 |
--------------------------------------------------------------------------------
/adaptor-testing-webapp/src/main/webapp/swagger-ui/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 | <%@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 |
--------------------------------------------------------------------------------
/img/SpecificationDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSLC/lyo-adaptor-sample-modelling/3a129755b78ec9f38a622fd084acde2f0e195ce1/img/SpecificationDiagram.png
--------------------------------------------------------------------------------
/img/ToolchainDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSLC/lyo-adaptor-sample-modelling/3a129755b78ec9f38a622fd084acde2f0e195ce1/img/ToolchainDiagram.png
--------------------------------------------------------------------------------
/toolchain-model/.gitignore:
--------------------------------------------------------------------------------
1 | /.settings/
2 |
--------------------------------------------------------------------------------
/toolchain-model/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | toolchain-model
4 |
5 |
6 |
7 |
8 |
9 |
10 | org.eclipse.sirius.nature.modelingproject
11 |
12 |
13 |
--------------------------------------------------------------------------------
/toolchain-model/Pics/LyoToolchainModel-AdaptorInterfaceDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSLC/lyo-adaptor-sample-modelling/3a129755b78ec9f38a622fd084acde2f0e195ce1/toolchain-model/Pics/LyoToolchainModel-AdaptorInterfaceDiagram.png
--------------------------------------------------------------------------------
/toolchain-model/Pics/LyoToolchainModel-SpecificationDiagram-Original.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSLC/lyo-adaptor-sample-modelling/3a129755b78ec9f38a622fd084acde2f0e195ce1/toolchain-model/Pics/LyoToolchainModel-SpecificationDiagram-Original.png
--------------------------------------------------------------------------------
/toolchain-model/Pics/LyoToolchainModel-SpecificationDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSLC/lyo-adaptor-sample-modelling/3a129755b78ec9f38a622fd084acde2f0e195ce1/toolchain-model/Pics/LyoToolchainModel-SpecificationDiagram.png
--------------------------------------------------------------------------------
/toolchain-model/Pics/LyoToolchainModel-ToolchainDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSLC/lyo-adaptor-sample-modelling/3a129755b78ec9f38a622fd084acde2f0e195ce1/toolchain-model/Pics/LyoToolchainModel-ToolchainDiagram.png
--------------------------------------------------------------------------------
/toolchain-model/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OSLC/lyo-adaptor-sample-modelling/3a129755b78ec9f38a622fd084acde2f0e195ce1/toolchain-model/README.md
--------------------------------------------------------------------------------
/toolchain-model/license/edl-v10.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Eclipse Distribution License - Version 1.0
8 |
25 |
26 |
27 |
28 |
29 |
30 |
Eclipse Distribution License - v 1.0
31 |
32 |
Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.
33 |
34 |
All rights reserved.
35 |
Redistribution and use in source and binary forms, with or without modification,
36 | are permitted provided that the following conditions are met:
37 |
Redistributions of source code must retain the above copyright notice,
38 | this list of conditions and the following disclaimer.
39 |
Redistributions in binary form must reproduce the above copyright notice,
40 | this list of conditions and the following disclaimer in the documentation
41 | and/or other materials provided with the distribution.
42 |
Neither the name of the Eclipse Foundation, Inc. nor the names of its
43 | contributors may be used to endorse or promote products derived from
44 | this software without specific prior written permission.
45 |
46 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
47 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
48 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
49 | IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
50 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
51 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
52 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
53 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
55 | POSSIBILITY OF SUCH DAMAGE.