Skip to content
Ale Sánchez edited this page Apr 9, 2019 · 33 revisions

Introduction

IDEAS is a Java application environment made up of three projects:

ideas-studio is a java web project which uses functionalities of ideas-repo, and it is ready to connect with modules containing different languages.

ideas-base-module is a java library which collects functionality to create a language module. Every language module uses this library.

ideas-repo is a java library which collects all the functionality of file management, user, etc…

Design

IDEAS is designed to be deployed independently of the language modules. Each language module is a standalone web application that provides a REST API that makes use of IDEAS.

Requirements

  1. Java JDK 7 or 8. JRE won’t work. You will need JDK for developing with Maven.Developers.
  2. Eclipse for Java EE or Netbeans IDE
  3. MySQL. You can use XAMPP. Or you can use H2 as a memory database. If you use H2 you don't need to install anything.
  4. SourceTree.

Installation

Follow this guide to setup IDEAS environment in your system.

  1. Git and Sourcetree:

The first thing you have to do is to install Sourcetree. It's an easy and intuitive way to work with git repositories. Clone ideas-studio and ideas-repo repositories. In this step, ideas-base-module is not required, because is only used to deploy modules.

Checkout the **master** and **develop** branches. If you have any questions, check the guide [Sourcetree](https://www.sourcetreeapp.com/) available in section guides.
  1. Java:

    A version of the JDK (JRE is not valid) is required. If you don't have it yet, can download and install it.

    To set the usage JDK instead of JRE in Eclipse:

    1. Go to Eclipse preferences
    2. In the left panel: Java> Installed JREs
    3. Add JDK using the installation directory
    4. Make sure that you have checked JDK and uncheck JREs.
  2. Eclipse:

    1. Once we have all the necessary products, we proceed to import it into Eclipse. Install Eclipse for Java EE Developers version. It will save a lot of time. At least it would be necessary to have a maven plugin for Eclipse, eg: m2e - Maven Eclipse Integration.
    2. Import projects: Import > Maven > Maven Existing Projects
    3. When you import each project conducted a mvn install: Right-click on the Project > Run As > Maven install
  3. Netbeans IDE

    1. Once we have all the necessary products, we proceed to import it into Ecplise. First of all, Install Netbeans. You can download it from: https://netbeans.org/downloads/. You don’t have to download Maven because it is installed by default in Netbeans.
    2. Open projects: File > Open project…
    3. When you import each project conducted a mvn install: Right click on the project > Clean and build.
  4. Database configuration:

    To switch between MySQL and H2 you have to comment/uncomment some lines in the file src > main > resources > application.properties. The MySQL lines are 4-9 and the H2 ones 12-20. Comment the block of lines you won't use and uncomment the ones you'll use.

    If you use MySQL:

    1. Create a database with the example name "ideas" or any other you want, and give it a user account privilege, in our example we will use "user" and "password". ideas-studio is configured by default with these example values.

    2. Set the following ENV variables. The project will look for them automatically and use for connecting to the database:

    DB_URL=localhost
    DB_PORT=3306
    DB_NAME=ideas
    DB_USER=user
    DB_PASSWORD=password
    
    1. Create the database user with the password you specified in the DB_PASSWORD variable, and give him privilege to access and modify the database.

    2. Create ideas database basic schema by importing ideas_db_dump.sql.

    If you want to use H2. You have to access the browser console at http://localhost:8080/h2-console/. Connect to ideas database using sa as username and no password. Then you need to create the database basic schema running the ideas_h2_dump.sql

  5. Deploy:

    To deploy the application, you need to install all the dependencies and run the file at src > main > java > es > us > isa > ideas > app > IdeasStudioApplication.java and Spring Boot will create an embedded tomcat server. Once the application has finished deploying, you could access it at http://localhost:8080.

Configuration

Language module

To configure the application with a module:

  1. Open the studio configuration file ideas-studio > src > main > webapp > WEB-INF > config > studio-configuration.json.

    Note: if you are contributing on this project you should never modify the "studio-configuration.json" file. Instead of that, you must create a "develop-configuration.json" on the same path and with the same structure of the studio configuration file. The "studio-configuration.json" should be only modified by a release manager. For more information, please, check the Development Policy section.

  2. Add a new line with the key value pair "id: uri" into "languages", indicating the module configuration values. For example, if you want to deploy the iAgree Template Language module, add the lines below:

    {
        "languages": {
            "iagree-template-language": "/ideas-iagree-template-language"
        }
    }

    If you don't know which "id: uri" to add, you can find these values in "ideas-module-name" > src > main > webapp > WEB-INF > classes > language_manifest.json. The "uri" value correspond to the name of the generated language module .war file.

Login Social

You can find the necessary information to authenticate with Facebook, Twitter and Google in the ideas-studio > src > main > resources > application.properties file. They are configured to work with IDEAS APIs by default.

If you want to set up a social login for a new application, you will need to create social profiles in that application and add the properties with the name [network].consumerKey and [network].consumerSecret.

Troubleshooting

Denied user access

By default, a database user has access to all servers. This is specified by the symbol "%" in the "Server" column. In some cases it is necessary to indicate that the user explicitly has access to "localhost" server.

Problems with Maven or display

Sometimes Maven plugin for Eclipse does not behave well when you execute mvn clean or mvn install on a parent project, and it doesn't perform well the actions on children subprojects.

If that is your case, you solve it by:

  1. Using the command line instead of the Maven plugin.
  2. Perform a mvn clean and/or mvn install on subprojects directly.

No class or method errors found at runtime

Sometimes Maven/Eclipse don't add the a jar correctly, for example in iagree-commons.

You can solve it by:

  1. Right-click on Eclipse embedded server
  2. Click on Clean Tomcat Directory.
  3. Right-click on Eclipse embedded server again and click on Clean ....

Projects problems

If the project isn't recognize as a web project, please, check if the Project Facet is correctly configured. To do that:

  • Right-click on the project, Properties > Project Facets

Problem with converters to deploy-app Ideas

We have detected an exception related to Spring converters when you try to deploy IDEAS application (not when you compile it).

Nowadays, we haven't found yet whence the problem comes. But we know that you can solve it by:

  1. Executing mvn clean install
  2. Re-deploy IDEAS.

Eclipse and Maven

Eclipse doesn't display correctly the Web application even though everything seems to be well configured

  • In the servers tab, right-click on the server:
    • Clean.
    • Clean deploy.
  • In preferences/.../runtime environment > remove the used server.
  • Clean Maven project.
  • In the project properties, go to deployment assembly > Delete "maven dependences" and other projects (CAUTION: only dependency projects, no one else).
  • Close and re-open Eclipse.
  • Run Maven update in your project.
  • Run Maven install.
  • Check again deploy assembly that is in Maven Dependencies. If they are missing, add them.
  • Add new server (Servers tab) add the necessary projects.
  • If necessary, change the configuration in server.xml to accept SSL on port 8181.