Skip to content
Eldelshell edited this page May 7, 2020 · 6 revisions

Introduction

How to build and run Amforeas from sources.

Requirements

  • git
  • JDK 11
  • Maven 3
  • 5 minutes

Project

Amforeas is divided as maven modules:

  • amforeas-core is the main project and all common code lives.
  • amforeas-jetty is the project for the Jetty embedded implementation.
  • amforeas-jersey is the project for jersey 2.x stuff
  • amforeas-war generates a war for EAS servers like Tomcat or Wildfly
  • amforeas-demo generates a demo backend with an in-memory database to test
  • amforeas-client is the project for the Java client library

Usefull Maven targets

  • mvn clean install
  • mvn test
  • cd amforeas-jetty && mvn package -P dist
  • cd amforeas-demo && mvn package -P dist
  • cd amforeas-demo && mvn exec:java
  • cd amforeas-war && mvn org.codehaus.cargo:cargo-maven2-plugin:run

Build

  1. Clone the repository:
  2. Go into the amforeas directory
  3. Execute mvn install

Demo

To execute Amforeas in demo mode and see what is capable of:

$ cd amforeas
$ mvn clean install
$ cd amforeas-demo
$ mvn exec:java
$ curl -X GET "http://localhost:8080/amforeas-as/demo1/users/1"

Eclipse

You can also use the Run as Java Application option in Eclipse to execute the amforeas.demo.AmforeasDemo.

Packaging

Amforeas Standalone

Go to the amforeas-jetty project and execute mvn package -P dist. This will generate the distribution file in the target directory:

  • amforeas-VERSION-distribution-VERSION.zip

Amforeas WAR

Go to the amforeas-war project and execute mvn install. This will generate a war file in the target directory. This war should be deployed in any container... at least it should work in Tomcat6+

Amforeas Demo

Go to the amforeas-demo project and execute mvn package -P dist. This will generate the demo distribution file in the target directory:

$ cd target
$ unzip amforeas-*-demo.zip
$ cd amforeas-demo
$ ./amforeas-demo.sh start
$ curl "http://localhost:8080/amforeas/stats"
$ curl -k "https://localhost:8443/amforeas/stats"

Developing for Unsupported Databases

If you have access to an unsupported database, you can help us out by writting support for it. This is very easy, clone the amforeas project and go to the amforeas/amforeas-core/src/main/java/amforeas/sql/dialect directory or package. Let's see, for example, the MSSQLDialect.java file which provides support for MS-SQL.

public class MSSQLDialect extends SQLDialect {
    
    private static final Logger l = LoggerFactory.getLogger(MSSQLDialect.class);

    @Override
    public String listOfTablesStatement() {
        return "select * from information_schema.tables where Table_Type = 'BASE TABLE'";
    }
}

The SQLDialect class implements operation for SQL98 & SQL2008 standards. You should override any method which is special for the RDBMS.