Skip to content

componentMiddleware

Lukas Schmelzeisen edited this page Dec 10, 2013 · 7 revisions

Getting started

Install tomcat.

Open your tomcat-users.xml (on my system it lives under /etc/tomcat/tomcat-users.xml. Make sure you define the role manager-script and that you have a user that has it:

<role rolename="manager-script"/>
<user username="tomcat" password="tomcat" roles="manager-script"/>

Open your maven settings file settings.xml (on my system it lives under ~/.m2/settings.xml. Under the <servers> tag define the following:

<server>
  <id>tomcat-server</id>
  <username>your tomcat user</username>
  <password>your tomcat password</password>
</server>

Get the middleware code:

git clone https://github.com/renepickhardt/metalcon.git
git checkout feature/middleware
cd middleware

You can deploy the middleware to tomcat (make sure its running!) like this:

mvn tomcat7:deploy

The middleware is now accessible under http://localhost:8080/middleware/.

Note: this only works if the middleware is not deployed already. If it already is use mvn tomcat7:redeploy.

You can also start the middleware in a separate jetty instance using:

mvn jetty:run

The middleware is now accessible under http://localhost:8000/.

Jetty automatically detects changes in the java code and reloads recompiled java classes (current autodetect cycle is every 5 seconds). Jetty also instantly has all changed template code available. So for developing you will most likely only use jetty instead of tomcat. Sometimes autodetecting doesn't work correctly, if you are getting weird results kill jetty with Ctrl-C and restart.

Templates / Views

The middleware views are written in FreeMarker templates.

Documentation is available in the FreeMarker Manual. If you only want to program views you need to read the Template Authors Guide. If you want to develop middleware logic you should probably read the whole thing.

Middleware logic / Controller

The middleware is written in java with Spring.

We are using ØMQ to talk to our backend components.

Clone this wiki locally