Skip to content

Commit bce46b1

Browse files
authored
Merge pull request #120 from common-workflow-language/cwltool
Cwltool parsing and API
2 parents e58485d + d1cf192 commit bce46b1

File tree

207 files changed

+32457
-2257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+32457
-2257
lines changed

Diff for: .travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ services: mongodb
77

88
before_install:
99
- sudo apt-get -qq update
10-
- sudo apt-get install graphviz
10+
- sudo apt-get install graphviz python-pip
11+
- sudo pip install cwltool
1112

1213
notifications:
1314
webhooks:
1415
urls:
1516
- https://webhooks.gitter.im/e/abea7d67d180d37286b3
1617
on_success: change # options: [always|never|change] default: always
1718
on_failure: always # options: [always|never|change] default: always
18-
on_start: never # options: [always|never|change] default: always
19-
19+
on_start: never # options: [always|never|change] default: always

Diff for: Dockerfile

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM maven:3.3-jdk-8-alpine
1+
FROM maven:3.5-jdk-8-alpine
22
MAINTAINER Stian Soiland-Reyes <[email protected]>
33

44
# Build-time metadata as defined at http://label-schema.org
@@ -16,7 +16,14 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
1616
org.label-schema.schema-version="1.0"
1717

1818

19-
RUN apk add --update graphviz ttf-freefont && rm -rf /var/cache/apk/*
19+
RUN apk add --update graphviz ttf-freefont py2-pip gcc python2-dev libc-dev && rm -rf /var/cache/apk/*
20+
21+
22+
#wheel needed by ruamel.yaml for some reason
23+
RUN pip install wheel
24+
RUN pip install cwltool html5lib ruamel.yaml==0.12.4
25+
26+
RUN cwltool --version
2027

2128
RUN mkdir /usr/share/maven/ref/repository
2229

@@ -38,7 +45,4 @@ WORKDIR /tmp
3845

3946
EXPOSE 8080
4047

41-
# Expects mongodb on port 27017
42-
ENV SPRING_DATA_MONGODB_HOST=mongo
43-
ENV SPRING_DATA_MONGODB_PORT=27017
4448
CMD ["/usr/bin/java", "-jar", "/usr/lib/cwlviewer.jar"]

Diff for: LICENSE.md

-21
Original file line numberDiff line numberDiff line change
@@ -199,24 +199,3 @@
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201201
limitations under the License.
202-
203-
---------------------------------------------------------
204-
205-
./src/main/resources/static/img/GitHub-Mark-32px.png
206-
207-
GITHUB®, the GITHUB® logo design, OCTOCAT® and the OCTOCAT® logo design
208-
are exclusive trademarks registered in the United States by GitHub, Inc.
209-
210-
The OCTOCAT design is the exclusive property of GitHub, Inc and has
211-
been federally registered with the United States Copyright Office.
212-
All rights reserved.
213-
214-
Use rules apply: https://github.com/logos
215-
216-
---------------------------------------------------------
217-
218-
./src/main/resources/static/img/Docker-logo.png
219-
220-
Copyright 2013-2015 Docker, Inc. All rights reserved.
221-
222-
Use rules apply: https://www.docker.com/brand-guidelines

Diff for: NOTICE.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ For more information regarding the authorized uses of these items please [contac
7676

7777
-----------
7878

79+
# Git logo
80+
img/gitlogo.png
81+
Git Logo by Jason Long is licensed under the [Creative Commons Attribution 3.0 Unported License](https://creativecommons.org/licenses/by/3.0/)
82+
83+
-----------
84+
7985
# European Union flag
8086
img/Flag_of_Europe.svg
8187
Public Domain
@@ -170,4 +176,12 @@ https://github.com/ariutta/svg-pan-zoom
170176

171177
[BSD 2-clause license](src/main/resources/static/bower_components/svg-pan-zoom/LICENSE)
172178

173-
-----------
179+
----------
180+
181+
# highlight.js
182+
bower_components/highlightjs
183+
https://highlightjs.org/
184+
185+
[BSD 3-clause license](src/main/resources/static/bower_components/highlightjs/LICENSE)
186+
187+

Diff for: README.md

+33-50
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ provide a [pull request](https://github.com/common-workflow-language/cwlviewer/p
1919
or join the [gitter chat for common-workflow-language](https://gitter.im/common-workflow-language/common-workflow-language)!
2020

2121

22-
## Running with Docker
22+
## Recommended - Running with Docker
2323

2424
This application can be started with [Docker](https://www.docker.com/).
2525

26-
If you have [Docker Compose](https://docs.docker.com/compose/install/), then to start
27-
MongoDB and CWLViewer exposed on port `8080`, run:
26+
If you have [Docker Compose](https://docs.docker.com/compose/install/), then to start CWLViewer exposed on port `8080`, run:
2827

2928
docker-compose up
3029

@@ -42,7 +41,6 @@ services:
4241
build: .
4342
```
4443
45-
4644
See the [docker-compose.yml](docker-compose.yml) file for details.
4745
4846
If you don't want to use Docker Compose, you can do the equivalent manually with `docker`
@@ -51,67 +49,33 @@ and the [commonworkflowlanguage/cwlviewer](https://hub.docker.com/r/commonworkfl
5149
docker run --name cwlviewer-mongo -p 27017:27017 -d mongo
5250
docker run --name cwlviewer -p 8080:8080 --link cwlviewer-mongo:mongo -d commonworkflowlanguage/cwlviewer
5351
docker logs -f cwlviewer
52+
53+
54+
**WARNING**: Please ensure that your MongoDB installation is not exposed to the world on port `27017`
5455

5556
If you have modified the source code, then you may want to build the docker image locally first:
5657

5758
docker build -t commonworkflowlanguage/cwlviewer .
5859

60+
## Running without Docker
61+
62+
### Requirements
5963

60-
## Requirement: MongoDB
64+
#### MongoDB
6165

6266
You will need to have [MongoDB](https://www.mongodb.com/) running,
63-
by default on `localhost:27017`.
67+
by default on `localhost:27017`
6468

6569
If you are running from the command line, you can override this by supplying
6670
system properties like `-Dspring.data.mongodb.host=mongo.example.org` and
6771
`-Dspring.data.mongodb.port=1337`
6872

69-
If you have Docker, but are not using the Docker Compose method above,
70-
you may start MongoDB with [Docker](https://www.docker.com/) using:
71-
72-
docker run --name cwlviewer-mongo -p 27017:27017 -d mongo
73-
74-
**WARNING**: The above expose mongodb to the world on port `27017`.
75-
76-
## Configuration
77-
78-
There are a variety of configuration options detailed in the [application configuration file](https://github.com/common-workflow-language/cwlviewer/blob/master/src/main/resources/application.properties) which can be adjusted.
79-
80-
When deploying with docker, these can be overriden externally by creating/modifying `docker-compose.override.yml` as follows:
81-
82-
```yaml
83-
version: '2'
84-
services:
85-
spring:
86-
environment:
87-
githubAPI.authentication: oauth
88-
githubAPI.oauthToken: abcdefghhijklmnopqrstuvwxyz
89-
```
90-
91-
The properties can alternatively be provided as system properties on the
92-
command line, e.g. `-DgithubAPI.authentication=oauth`
93-
`-DgithubAPI.oauthToken=abcdefghhijklmnopqrstuvwxyz` or via a [variety of other methods supported by Spring Boot](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html)
94-
95-
### Github API
96-
97-
If you run cwlviewer in production, you are likely to hit the GitHub API's rate limit of 60 requests/hr. This can be increased to 5000 requests/hr by using authentication (either basic or OAuth) by setting the `githubAPI.authentication` and either `githubAPI.oauthToken` or both `githubAPI.username` and `githubAPI.password` in the [application configuration file](https://github.com/common-workflow-language/cwlviewer/blob/master/src/main/resources/application.properties) depending on the method.
73+
#### Apache Jena Fuseki (or alternative SPARQL server)
9874

99-
OAuth tokens can be obtained using the [Github authorizations API](https://developer.github.com/v3/oauth_authorizations/).
75+
You will also need to have a SPARQL server such as [Apache Jena Fuseki](https://jena.apache.org/documentation/fuseki2/) running,
76+
by default on `localhost:3030`
10077

101-
## Private Repositories
102-
103-
If you wish to use cwlviewer to view private Github repositories, set
104-
105-
```
106-
githubAPI.useForDownloads = true
107-
singleFileSizeLimit = 1048575
108-
```
109-
110-
Along with an authentication method which has the privileges necessary to access the repository (see above).
111-
112-
**WARNING**: This uses the [Github Contents API](https://developer.github.com/v3/repos/contents/) to download files instead of [Rawgit](https://rawgit.com/) which will increase API calls significantly.
113-
114-
## Building and Running
78+
## Compiling and Running
11579

11680
To compile you will need [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or OpenJDK 8 (`apt install openjdk-8-jdk`),
11781
as well as [Apache Maven 3](https://maven.apache.org/download.cgi) (`apt install maven`).
@@ -145,6 +109,25 @@ org.researchobject.CwlViewerApplication : Started CwlViewerApplication in 28.60
145109

146110
Now check out http://localhost:8080/ to access CWL Viewer.
147111

112+
## Configuration
113+
114+
There are a variety of configuration options detailed in the [application configuration file](https://github.com/common-workflow-language/cwlviewer/blob/master/src/main/resources/application.properties) which can be adjusted.
115+
116+
When deploying with docker, these can be overriden externally by creating/modifying `docker-compose.override.yml` as follows:
117+
118+
```yaml
119+
version: '2'
120+
services:
121+
spring:
122+
environment:
123+
githubAPI.authentication: oauth
124+
githubAPI.oauthToken: abcdefghhijklmnopqrstuvwxyz
125+
```
126+
127+
The properties can alternatively be provided as system properties on the
128+
command line, e.g. `-DgithubAPI.authentication=oauth`
129+
`-DgithubAPI.oauthToken=abcdefghhijklmnopqrstuvwxyz` or via a [variety of other methods supported by Spring Boot](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html)
130+
148131
# Thanks
149132

150133
Developers and [contributors](https://github.com/common-workflow-language/cwlviewer/graphs/contributors) include:

Diff for: docker-compose.yml

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
version: '2'
22
services:
33
spring:
4-
image: commonworkflowlanguage/cwlviewer
4+
# To run from this source code instead of Docker hub,
5+
# disable "image:"" and enable "build:" below
6+
image: commonworkflowlanguage/cwlviewer
57
#build: .
68
ports:
79
- "8080:8080"
8-
# TODO:
9-
# volumes:
10-
# - .:/code
1110
links:
1211
- mongo
13-
12+
- sparql
13+
environment:
14+
- SPARQL_ENDPOINT=http://sparql:3030/cwlviewer/
15+
- SPRING_DATA_MONGODB_HOST=mongo
16+
- SPRING_DATA_MONGODB_PORT=27017
1417
mongo:
1518
image: mongo
19+
sparql:
20+
## For debugging, expose the Fuseki port by enabling:
21+
# ports:
22+
# - "3030:3030"
23+
## To find the admin password, try:
24+
## docker-compose exec sparql grep admin /fuseki/shiro.ini
25+
image: stain/jena-fuseki
26+
# FIXME: --loc=/fuseki/databases/cwlviewer fails as it needs empty dir
27+
command: "/jena-fuseki/fuseki-server --loc=/fuseki/databases /cwlviewer"

Diff for: pom.xml

+18-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>org.commonwl.view</groupId>
77
<artifactId>cwlviewer</artifactId>
8-
<version>0.0.1-SNAPSHOT</version>
8+
<version>1.1.0-SNAPSHOT</version>
99
<packaging>jar</packaging>
1010

1111
<name>CWLViewer</name>
@@ -62,11 +62,6 @@
6262
<artifactId>commons-io</artifactId>
6363
<version>1.3.2</version>
6464
</dependency>
65-
<dependency>
66-
<groupId>org.eclipse.mylyn.github</groupId>
67-
<artifactId>org.eclipse.egit.github.core</artifactId>
68-
<version>2.1.5</version>
69-
</dependency>
7065
<dependency>
7166
<groupId>org.yaml</groupId>
7267
<artifactId>snakeyaml</artifactId>
@@ -88,9 +83,24 @@
8883
</exclusion>
8984
</exclusions>
9085
</dependency>
91-
</dependencies>
86+
<dependency>
87+
<groupId>com.fasterxml.jackson.core</groupId>
88+
<artifactId>jackson-core</artifactId>
89+
<version>2.9.0.pr4</version>
90+
</dependency>
91+
<dependency>
92+
<groupId>org.apache.jena</groupId>
93+
<artifactId>jena-osgi</artifactId>
94+
<version>3.3.0</version>
95+
</dependency>
96+
<dependency>
97+
<groupId>org.eclipse.jgit</groupId>
98+
<artifactId>org.eclipse.jgit</artifactId>
99+
<version>4.8.0.201706111038-r</version>
100+
</dependency>
101+
</dependencies>
92102

93-
<build>
103+
<build>
94104
<plugins>
95105
<plugin>
96106
<groupId>org.springframework.boot</groupId>

Diff for: src/main/java/org/commonwl/view/PageController.java

+20
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,24 @@ public String homePage(Model model, @RequestParam(value = "url", required = fals
3939
return "index";
4040
}
4141

42+
/**
43+
* About page
44+
* @param model The model for the about page
45+
* @return The view for this page
46+
*/
47+
@GetMapping("/about")
48+
public String about(Model model) {
49+
return "about";
50+
}
51+
52+
/**
53+
* API documentation page
54+
* @param model The model for the API documentation page
55+
* @return The view for this page
56+
*/
57+
@GetMapping("/apidocs")
58+
public String apiDocumentation(Model model) {
59+
return "apidocs";
60+
}
61+
4262
}

Diff for: src/main/java/org/commonwl/view/cwl/CWLElement.java

+21-1
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,26 @@
1919

2020
package org.commonwl.view.cwl;
2121

22+
import com.fasterxml.jackson.annotation.JsonInclude;
23+
2224
import java.util.ArrayList;
2325
import java.util.List;
2426

2527
/**
2628
* Represents the input/output of a workflow/tool
2729
*/
30+
@JsonInclude(JsonInclude.Include.NON_EMPTY)
2831
public class CWLElement {
2932

3033
private String label;
3134
private String doc;
3235
private String type;
36+
private String format;
3337
private List<String> sourceID;
3438
private String defaultVal;
3539

3640
public CWLElement() {
37-
this.sourceID = new ArrayList<String>();
41+
this.sourceID = new ArrayList<>();
3842
}
3943

4044
public String getLabel() {
@@ -61,6 +65,22 @@ public void setType(String type) {
6165
this.type = type;
6266
}
6367

68+
public String getFormat() {
69+
return format;
70+
}
71+
72+
public void setFormat(String format) {
73+
this.format = format;
74+
}
75+
76+
public List<String> getSourceID() {
77+
return sourceID;
78+
}
79+
80+
public void setSourceID(List<String> sourceID) {
81+
this.sourceID = sourceID;
82+
}
83+
6484
public List<String> getSourceIDs() {
6585
return sourceID;
6686
}

0 commit comments

Comments
 (0)