Skip to content

Commit

Permalink
ewa project commit
Browse files Browse the repository at this point in the history
  • Loading branch information
john-stam committed Jun 4, 2020
0 parents commit f076c62
Show file tree
Hide file tree
Showing 3,356 changed files with 877,688 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
target
nb-configuration.xml
nbactions.xml
.idea/
*.iml
editors/src/main/webapp/static/ewa/scripts/
editors/src/main/webapp/static/ewa/styles/
editors/src/main/webapp/WEB-INF/pages/
editors/src/main/resources/ewa-editors-config.properties
editors/src/main/resources/ewa-remote-upload-partners.properties
editors/src/main/resources/cloud-share-config/google-service-account-key-development.json
editors/src/main/resources/cloud-share-config/google-service-account-key-staging.json
editors/src/main/resources/cloud-share-config/google-service-account-key-production.json
editors/src/main/webapp/stats/stats-config.properties
internationalisation/extraction/src/main/resources/config.properties
internationalisation/templates/src/main/resources/config.properties
office/server/src/main/resources/config.properties
services/editors/src/main/resources/config.properties
services/rest/src/main/resources/config.properties
services/statistics/src/main/resources/config.properties
tools/zanataLiteralsUpdate/src/main/resources/config.properties
tools/ganalytics/src/test/resources/analytics.properties
tools/ganalytics/src/test/resources/client_secrets.json
tools/ganalytics/src/test/resources/europass.analytics.p12
12 changes: 12 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
118 changes: 118 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# EWA (Europass Web Apps - Cedefop)

**EWA (Europass Web Apps - Cedefop)** is a Java-based web system helping EU Citizens create their CV in the standardised Europass format.

It consists of the following main modules:

1. **Editors**: This is the main online CV Editor application which is called first when a user requests
the home page (URL active on 1/6/2020,  https://europass.cedefop.europa.eu/editors). It’s responsible for
assembling the front-end part of EWA (a JavaScript-based Single Page Application) by detecting the User Agent,
Locale, etc. and creating the initial HTML page that the user sees with suitable variables.

2. **API**: This is the heart of EWA where most of the processing and business logic takes place:
data model, marshalling/unmarshalling of XML/JSON to Java objects and vice versa, file type
detection, image processing, error handling and messages, session management, population
of ODT template with user-entered data, downloads, emails, export to cloud services,
database interactions, etc.

3. **Office**: The module responsible for converting ODT templates to PDF and DOC as well as for
managing the lifecycle of the underlying LibreOffice binaries.

4. **REST API**: This is also a Java application which runs in isolation from the other modules, but nevertheless shares some common
libraries (JARs) with the API module. The Europass REST API mostly provides a set of conversion services which allow external systems
to send a Europass XML or JSON document and get back a Europass document of a different file format such as PDF+XML.

## Prerequisites
```
JDK 1.7
Maven 3
Tomcat 7
SQL Server
LibreOffice 4.0
```
## Database

Europass editor is currently using a Microsoft SQL Server database.
Create a new database called `ewa_prod` and a database user and then run the script that can be found in the statistics module to create the database structure
(path to script: europass-editors/statistics/src/main/resources/sql/ewa_prod_creation.sql).

## Configuration

1. Add the following application data source in Tomcat's server.xml under the GlobalNamingResources element (jtds library should be added to Tomcat's lib folder).
```
<Resource name="jdbc/EWA_STATISTICS"
type="javax.sql.DataSource"
auth="Container"
driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://<SERVER_NAME>:1433;instance=MSSQLSERVER;DatabaseName=ewa_prod"
username="<USERNAME>"
password="<PASSWORD>"
maxActive="300" maxIdle="2" maxWait="5000"
removeAbandoned="true" removeAbandonedTimeout="60" />
```
2. Add the following context initialization parameters to Tomcat's context.xml to set the properties paths for all modules and make them visible to the web application:
```
<Parameter name="europass-ewa-editors.external.config.properties" override="false" value="<EUROPASS_ROOT_FOLDER>/editors/src/main/resources/ewa-editors-config.properties" />
<Parameter name="europass-ewa-services-remote-upload-postback.external.config.properties" override="false" value="<EUROPASS_ROOT_FOLDER>/editors/src/main/resources/ewa-remote-upload-partners.properties" />
<Parameter name="europass-ewa-services-editors.external.config.properties" override="false" value="<EUROPASS_ROOT_FOLDER>/services/editors/src/main/resources/config.properties" />
<Parameter name="database-api.external.config.properties" override="false" value="<EUROPASS_ROOT_FOLDER>/services/editors/src/main/resources/database.properties" />
<Parameter name="europass-ewa-services-rest.external.config.properties" override="false" value="<EUROPASS_ROOT_FOLDER>/services/rest/src/main/resources/config.properties" />
<Parameter name="database-rest.external.config.properties" override="false" value="<EUROPASS_ROOT_FOLDER>/services/rest/src/main/resources/database.properties" />
<Parameter name="europass-ewa-oo-server.external.config.properties" override="false" value="<EUROPASS_ROOT_FOLDER>/office/server/src/main/resources/config.properties"/>
```
3. Create the following directories under Tomcat:
```
<TOMCAT_INSTALLATION_DIR>/ewa-conf/webapp-editors-logback-config
<TOMCAT_INSTALLATION_DIR>/ewa-conf/webapp-api-logback-config
<TOMCAT_INSTALLATION_DIR>/ewa-conf/webapp-office-logback-config
<TOMCAT_INSTALLATION_DIR>/ewa-conf/webapp-rest-logback-config
```
and copy the logback.xml files from respective modules.
Then modify the logback.xml files for each one of the modules so that they point to the right directory in Tomcat where the respective log file will be stored.
4. Adjust properties files to use the correct configurations.
- In the Editors module resources folder (editors/src/main/resources) rename the `ewa-editors-config-default.properties` file to `ewa-editors-config.properties`
and the `ewa-remote-upload-partners-default.properties` file to `ewa-remote-upload-partners.properties` and fill/edit the respective property values according
to the comments in the file.
- In the Editors module under the stats folder (editors/src/main/webapp/stats) rename the `stats-config-default.properties` file to `stats-config.properties` and fill/edit the respective property values according
to the comments in the file.
- In the cloud-share-config folder under the editors module resources folder fill the google service authentication properties. Rename the `google-service-account-key-development-${ENVIRONMENT}.json` file according to the
value of the `context.project.current.environment` in `ewa-editors-config.properties` e.g if context.project.current.environment=production then the json file name should be
google-service-account-key-development-production.json
- In the Internationalisation module under the extraction resources folder (internationalisation/extraction/src/main/resources) rename the `config-default.properties` file to `config.properties`
and fill/edit the respective property values according to the comments in the file.
- In the Internationalisation module under the templates resources folder (internationalisation/templates/src/main/resources) rename the `config-default.properties` file to `config.properties`
and fill/edit the respective property values according to the comments in the file.
- In the office module under the server resources folder (office/server/src/main/resources) rename the `config-default.properties` file to `config.properties`
and fill/edit the respective property values according to the comments in the file.
- In the API module under the editors resources folder (services/editors/src/main/resources) rename the `config-default.properties` file to `config.properties`
and fill/edit the respective property values according to the comments in the file.
- In the REST API module under the rest resources folder (services/rest/src/main/resources) rename the `config-default.properties` file to `config.properties`
and fill/edit the respective property values according to the comments in the file.
- In the API module under the statistics resources folder (services/statistics/src/main/resources) rename the `config-default.properties` file to `config.properties`
and fill/edit the respective property values according to the comments in the file.
- In the tools module under the ganalytics test resources folder (tools/ganalytics/src/test/resources) rename the `analytics-default.properties` file to `analytics.properties`
and fill/edit the respective property values according to the comments in the file.
- In the tools module under the zanataLiteralsUpdate resources folder (tools/zanataLiteralsUpdate/src/main/resources) rename the `config-default.properties` file to `config.properties`
and fill/edit the respective property values according to the comments in the file.
5. Create `tmp-office-files` directory under Tomcat directory.
## Build
To build the project from command line run `mvn clean compile` from the project's root folder.
## Deploy
The four applications that need to be deployed under Tomcat are: editors, api, rest, office.
Run `mvn package` from the project's root folder to produce the war files.
Rename the war produced under editors/target to `editors.war`
Rename the war produced under services/editors/target to `api.war`
Rename the war produced under services/rest/target to `rest#v1.war`
Rename the war produced under office/server/target to `office.war`
and copy all four to Tomcat webapps folder.
Enable https and start Tomcat.
Binary file added __legacy-dependencies/qcms-api-5.8.5.jar
Binary file not shown.
Binary file added __legacy-dependencies/qcms-client-impl-5.7.0.jar
Binary file not shown.
Binary file added __legacy-dependencies/qcms-rest-5.8.5.jar
Binary file not shown.
Binary file added conversion-core/dependencies/jai_codec-1.1.3.jar
Binary file not shown.
Binary file added conversion-core/dependencies/jai_core-1.1.3.jar
Binary file not shown.
Binary file added conversion-core/dependencies/jai_imageio-1.1.jar
Binary file not shown.
174 changes: 174 additions & 0 deletions conversion-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>europass-webapps</artifactId>
<groupId>eu.europa.cedefop.europass.webapps</groupId>
<version>5.0.84</version>
</parent>

<artifactId>europass-webapps-conversion-core</artifactId>
<packaging>jar</packaging>
<name>Europass Document Conversion Core</name>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>install-jai-core</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>validate</phase>
<configuration>
<groupId>javax.media</groupId>
<artifactId>jai_core</artifactId>
<version>1.1.3</version>
<packaging>jar</packaging>
<file>${basedir}/dependencies/jai_core-1.1.3.jar</file>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>install-jai-imageio</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>validate</phase>
<configuration>
<groupId>com.sun.media</groupId>
<artifactId>jai_imageio</artifactId>
<version>1.1</version>
<packaging>jar</packaging>
<file>${basedir}/dependencies/jai_imageio-1.1.jar</file>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>install-jai-codec</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>validate</phase>
<configuration>
<groupId>com.sun.media</groupId>
<artifactId>jai_codec</artifactId>
<version>1.1.3</version>
<packaging>jar</packaging>
<file>${basedir}/dependencies/jai_codec-1.1.3.jar</file>
<generatePom>true</generatePom>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<!-- europass Model -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>europass-webapps-model</artifactId>
<version>${project.version}</version>
</dependency>
<!-- europass model dependency to tests -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>europass-webapps-model</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<!-- Guice -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-guice</artifactId>
</dependency>

<!-- Guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<!-- Mustache -->
<dependency>
<groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId>
</dependency>

<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>

<!-- File utilities -->
<dependency>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
<scope>compile</scope>
</dependency>

<!-- IMGSCALR -->
<dependency>
<groupId>org.imgscalr</groupId>
<artifactId>imgscalr-lib</artifactId>
</dependency>

<!-- JAI library -->
<dependency>
<groupId>javax.media</groupId>
<artifactId>jai_core</artifactId>
<scope>provided</scope>
</dependency>
<!-- Place in Tomcat lib or Java's ext/lib.
A mere restart of the webapp does not seem to properly load this library. -->
<dependency>
<groupId>com.sun.media</groupId>
<artifactId>jai_imageio</artifactId>
<scope>provided</scope>
</dependency>
<!-- Should be available just in runtime. Because of distribution rights,
it cannot be available through repository, so the solution is to place it
manually in tomcat's lib folder and keep this snippet as an
indication that is needed. -->
<dependency>
<groupId>com.sun.media</groupId>
<artifactId>jai_codec</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2002-2020 Cedefop.
*
* This file is part of EWA (Cedefop).
*
* EWA (Cedefop) is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EWA (Cedefop) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with EWA (Cedefop). If not, see <http ://www.gnu.org/licenses/>.
*/
package europass.ewa.conversion.exception;

import europass.ewa.exception.IdentifiableException;
import europass.ewa.model.conversion.exception.JacksonConversionStatus;

public class ODTAssemblyException extends RuntimeException implements IdentifiableException {

private static final long serialVersionUID = 4624665726187675741L;

public ODTAssemblyException(String message) {
super(message);
}

public ODTAssemblyException(Throwable cause) {
super(cause);
}

public ODTAssemblyException(String message, Throwable cause) {
super(message, cause);
}

@Override
public String getCode() {
return JacksonConversionStatus.MODEL_TO_ODT.getDesription();
}
}
Loading

0 comments on commit f076c62

Please sign in to comment.