Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Setting up an Intellij IDEA project for Arrowhead development

eudyptula edited this page Feb 25, 2019 · 2 revisions

Creating a compound project

Here I will set up a compound project, where all three java repositories can be shared in one Intellij IDEA workspace. You can skip this and do a normal Checkout from Version Control, to have them in separate Intellij windows.

  1. From Intellij's welcome screen, click "Create New Project" -> Maven -> Next

  2. Input the following (don't worry about version, it will be overridden by sub-projects anyway):

    GroupId: eu
    ArtifactId: arrowhead
    Version: 1.0-SNAPSHOT

  3. Click Next

  4. Input (feel free to change the location to anything you like):

    Project name: arrowhead
    Project location: ~/arrowhead

  5. Click Finish

  6. Delete the src folder

  7. Add <packaging>pom</packaging> to pom.xml (just under <version>1.0-SNAPSHOT</version>)

Create the core-java module

  1. Click VCS (menu) -> Checkout from version control -> Git

  2. Input (remember to change path if you created the project elsewhere):

    Url: https://github.com/arrowhead-f/core-java.git
    Directory: arrowhead/core-java

  3. Choose No to open the new project

  4. Optional: In the bottom right corner of the window, change the Git branch.

  5. Add to pom.xml under the packaging line:

    <modules>
        <module>core-java</module>
    </modules>
  6. Linux: Open a terminal and create symbolic links (this may not be available on all branches):
    Windows: Either copy the files manually, or search the web for how to create symbolic links.

    cd .idea
    ln -s ../../core-java/.idea/codeStyles
    mkdir runConfigurations
    cd runConfigurations
    ln -s ../../core-java/.idea/runConfigurations/* .
  7. (This step can be skipped until all modules are created) Click File (menu) -> Close Project, then reopen the project. Import maven project and configure Hibernate if asked. It should now be possible to build and run the core systems (see below).

Create the client-java module

  1. Click VCS (menu) -> Checkout from version control -> Git

  2. Input (remember to change path if you created the project elsewhere):

    Url: https://github.com/arrowhead-f/client-java.git
    Directory: arrowhead/client-java

  3. Choose No to open the new project

  4. Optional: In the bottom right corner of the window, change the Git branch.

  5. Add to pom.xml under the modules section:

    <module>client-java</module>
  6. Linux: Open a terminal and create symbolic links (this may not be available on all branches):
    Windows: Either copy the files manually, or search the web for how to create symbolic links.

    cd .idea
    mkdir runConfigurations
    cd runConfigurations
    ln -s ../../client-java/.idea/runConfigurations/* .
  7. (This step can be skipped until all modules are created) Click File (menu) -> Close Project, then reopen the project. Import maven project and configure Hibernate if asked. It should now be possible to build and run the core systems (see below).

Create the sos-examples module

  1. Click VCS (menu) -> Checkout from version control -> Git

  2. Input (remember to change path if you created the project elsewhere):

    Url: https://github.com/arrowhead-f/sos-examples.git
    Directory: arrowhead/sos-examples

  3. Choose No to open the new project

  4. Optional: In the bottom right corner of the window, change the Git branch.

  5. Add to pom.xml under the modules section:

    <module>sos-examples</module>
  6. Click File (menu) -> Close Project, then reopen the project. Import maven project and configure Hibernate if asked. It should now be possible to build and run the core systems (see below).

Create the database

First you need to install mysql and have a user which can create databases (root will do, but you may have to reconfigure MySQL or set a password for it to work, consult the MySQL documentation for this). Note that this user should not be named arrowhead, we'll create that later.

  1. In Intellij, open the Database pane.

  2. Click New (first icon) -> Data Source -> MySQL

  3. Enter your username and password for the database (the rest should be fine) and click Ok

  4. Right click on the database @localhost -> Run SQL Script...

  5. Choose the SQL file core-java/scripts/create_database_and_user.sql (may not be available on all branches).

You now have an empty Arrowhead database and an arrowhead user for it.

Run the core systems

For the secure versions pick the configuration ending with (TLS):

  1. Run the ServiceRegistryMain configuration first.

  2. Then run the Core Systems configuration to start the remaining systems.

  3. When asked to stop the Service Registry, click Cancel.

Run the client systems

First, you should start the consumer to get the base64 encoded authentication info for the secure mode:

  1. Run ConsumerMain. It will fail the first time around, this is okay.

  2. Find the Arrowhead_system table in the Database pane and double click on it.

  3. Insert a new row with (note that the id should be lower than the next one generated by hibernate, the easiest solution is to pick one lower than the existing ids):

    id: 1
    address: 0.0.0.0
    authentication_info: <null> (for secure systems insert the base64 string from the consumer output)
    port: 80 (443 for secure systems)
    system_name: consumer-demo

  4. Insert the record in the intra_cloud_authorization table also. You can find the necessary ids in the arrowhead_system and arrowhead_service tables.

  5. Run Demo Systems configuration to start all demo systems. For the secure versions pick the configuration ending with (TLS).

Clone this wiki locally