Skip to content

Commit 3b51dff

Browse files
committed
Initial version of oskari.org sample app
1 parent 585f19e commit 3b51dff

21 files changed

+7761
-4
lines changed

.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
*/bin/
2+
.DS_Store
3+
*/target/
4+
target/
5+
.settings/
6+
*/.classpath
7+
*/.project
8+
*.iml
9+
.classpath
10+
.idea
11+
.project
12+
/data/
13+
/test-output/
14+
/servlet-map/data/
15+
*pom.xml.versionsBackup
16+
*/nbactions.xml
17+
*/nb-configuration.xml
18+
.metadata

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
The MIT License (MIT)
22

3-
Copyright (c) 2019 Oskari.org
3+
Copyright (c) 2016 Oskari.org
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+72-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,72 @@
1-
# sample-server-extension
2-
Site visible in demo.oskari.org
1+
# Sample server-extension for Oskari
2+
3+
This is a template for extending oskari-server functionality using Maven.
4+
This application is running used in demo.oskari.org and dev.oskari.org.
5+
6+
Modify oskari-ext.properties:
7+
8+
db.additional.modules=myplaces, userlayer, example
9+
10+
# default view is the first appsetup
11+
view.default=1
12+
13+
# publish template is the second appsetup
14+
view.template.publish=2
15+
16+
# make myplaces etc baselayers have the correct projection for initial setup:
17+
oskari.native.srs=EPSG:3857
18+
19+
To enable end-user registration configure these (more information at http://oskari.org/documentation/features/usermanagement):
20+
21+
allow.registration=true
22+
oskari.email.sender=<[email protected]>
23+
oskari.email.host=<smtp.domain.com>
24+
25+
## Modifying the initial application setup:
26+
27+
1) You will need a Java migration to run your setup file like this:
28+
29+
app-resources/src/main/java/flyway/example/V1_0_0__initial_db_content.java
30+
31+
Or you can run these as individual flyway migrations.
32+
33+
*Note!* All database tables are created with the core migration.
34+
35+
2) Your setup should add application specific content like layers, users, appsetups.
36+
37+
You can reference sql files under oskari-server/content-resources like adding inspire-themes:
38+
39+
app-resources/src/main/resources/setup/app-example.json
40+
41+
You can modify data providers and users as this is just another example overriding the sample setup:
42+
43+
app-resources/src/main/resources/sql
44+
45+
For example if you would like to have a non-admin user you can add these lines to app-resources/src/main/resources/sql/initial-users.sql:
46+
47+
-- add user;
48+
INSERT INTO oskari_users(user_name, first_name, last_name, uuid) VALUES('user', 'Oskari', 'Olematon', 'fdsa-fdsa-fdsa-fdsa-fdsa');
49+
50+
-- add role to user;
51+
INSERT INTO oskari_role_oskari_user(user_id, role_id) VALUES((SELECT id FROM oskari_users WHERE user_name = 'user'), (SELECT id FROM oskari_roles WHERE name = 'User'));
52+
53+
-- add credentials user/user for non-admin user (You can use for example https://www.browserling.com/tools/bcrypt to create a password);
54+
INSERT INTO oskari_jaas_users(login, password) VALUES('user', '$2a$10$0VHUAhiInPL77O12guO3lOaCdxd/Hfhz4L8qA3Jb4FAw.u8Y.3cMG');
55+
56+
Layers can be configured in json:
57+
58+
app-resources/src/main/resources/json/layers
59+
60+
And referenced in app setups like this:
61+
62+
app-resources/src/main/resources/json/views/geoportal-3857.json
63+
64+
Compile with:
65+
66+
mvn clean install
67+
68+
Replace oskari-map.war under {jetty.home}/webapps/ with the one created under webapp-map/target
69+
70+
# Reporting issues
71+
72+
All Oskari-related issues should be reported here: https://github.com/oskariorg/oskari-docs/issues

app-resources/pom.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>org.oskari.demo</groupId>
8+
<artifactId>server-extension</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
</parent>
11+
<artifactId>app-resources</artifactId>
12+
<packaging>jar</packaging>
13+
<name>Resources for application</name>
14+
<dependencies>
15+
<dependency>
16+
<groupId>fi.nls.oskari</groupId>
17+
<artifactId>content-resources</artifactId>
18+
</dependency>
19+
</dependencies>
20+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package flyway.example;
2+
3+
import fi.nls.oskari.db.DBHandler;
4+
import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
5+
6+
import java.sql.Connection;
7+
8+
/**
9+
* Created by SMAKINEN on 30.1.2018.
10+
*/
11+
public class V1_0_0__initial_db_content implements JdbcMigration {
12+
13+
public void migrate(Connection connection)
14+
throws Exception {
15+
16+
DBHandler.setupAppContent(connection, "app-example");
17+
}
18+
}

0 commit comments

Comments
 (0)