The backend-code for the third phase of MoMo, http://www.bmbf.wasserressourcen-management.de/en/111.php
This repository will contain the sources for building the backend of the MoMo 3 project. It is intended to be used alongside its frontend companion https://github.com/terrestris/momo3-frontend.
This README contains a quickstart tutorial for developers.
Prerequisites:
- Java 1.7 or 1.8
- Maven 3.x
- Java Webapplication Server
- Sencha Cmd 6.0.2.14
- ExtJS 6
Recommended:
Fork and checkout [the sources of this project](https://github.com/ terrestris/momo3-backend):
-
Fork this project on github.
-
Go to your local workspace directory (assuming you work on Linux):
$ cd ~/workspace
-
Clone your fork to your device, e.g.:
$ git clone https://github.com/{{YOUR_GITHUB_ID}}/momo3-backend.git
-
Next, go into the just created directory:
$ cd momo3-backend/
-
In order to get all needed dependencies (e.g. the login/client/admin/doc/wiki), you need to sync all referenced submodules:
$ git submodule update --init --recursive
-
Finally add the remote repo as upstream:
$ git remote add upstream https://github.com/terrestris/momo3-backend.git
-
Verify the remote exists:
$ git remote -v
-
Note: This assumes that you have forked the momo3-frontend to your git account
YOUR_GITHUB_ID
.$ mvn scm:checkout -Dmaven-scm-plugin.git-username=YOUR_GITHUB_ID
- Make sure that the latest version of the m2e plugin is installed in your Eclipse IDE.
File
→Import
→Existing Maven Projects
- Browse your project root directory, e.g.
~/workspace/momo3-backend
- Click
Finish
to import the project to Eclipse - Right click on the imported project →
Run As
→Maven install
Note: You can import the SHOGun2 sources to Eclipse in the same way as described above. In this case, the m2e plugin recognizes that your SHOGun2 dependencies are in the same workspace and changes to the SHOGun2 sources will immediately be available in this project (if
Project
→Build Automatically
is enabled)
-
Download the ExtJS 6 sources to a location of your choice:
{{PATH_TO_EXT}}
. -
Go to the directory with the ExtJS application (momo3-frontend):
cd src/main/webapp/client
-
Inside this folder run
sencha app upgrade {{PATH_TO_EXT}}
-
If you get a warning "Failed to resolve package BasiGX" please do follow steps:
sencha package repo add GeoExt http://geoext.github.io/geoext3/cmd/pkgs
sencha package repo add BasiGX http://terrestris.github.io/BasiGX/cmd/pkgs
-
Run
sencha app refresh
-
Run
sencha app build
-
Refresh the project in Eclipse
-
In the case you haven't run the application before, you have to initialize the application database including some default entities by enabling the following properties (in folder
src/main/resources/META-INF
):-
hibernate.properties
:hibernate.hbm2ddl.auto=create
-
momo-init.properties
:-
init.shogunInitEnabled=true
-
init.projectInitEnabled=true
-
-
Note: Unless you're developing application models, it's recommended to reset the values from above to its defaults after the first startup. Otherwise the database is being initialized/overwritten on every application startup.
-
Add a server runtime environment to Eclipse:
Window
→Preferences
→Server
→Runtime Environments
→Add Tomcat 8 (or 7)
-
Set the
app.profile
variable -
Select your project in Eclipse
-
Run
→Run Configurations
→ Select yourApache Tomcat
runtime → Select theArguments
tab -
Add
-Dapp.profile=dev
to yourVM arguments
section -
To run the project on this server:
Right click on the project:
Run as
→Run on Server
→Select your Tomcat
-
Open
http://localhost:8080/momo/client/index.html?id={applicationId}
(If you haven't logged in yet, you will be asked to login as a valid user before)
Note: To get a valid {applicationId}
just follow these steps:
-
Adapt and open this URL:
http://localhost:8080/momo/application/findAll.action
-
The response will list all of your current SHOGun2 applications (and normally it should return the default one named Default Application only)
-
Find the entry
id
containing the ID of the application (e.g."id": 50
) -
Use this ID as GET parameter (see above)