The ONAP Portal SDK provides a sample web app to build and deploy to a Tomcat instance. The SDK App can be used standalone (i.e., command line) or within the Eclipse IDE. This page offers a quick-start guide for this webapp development.
Table of Contents |
---|
Browsing the SDK
...
Browsing the SDK
Release trees are archived in this Git release repository and available for browsing:
...
- Configure the server to ignore case on table names by setting the MySQL/MariaDB system variable called lower_case_table_names to value 1. Example line in the MySQL configuration file my.cnf within the [mysqld] section:
lower_case_table_names = 1
Create a database user, for example 'ecomp_sdk_user':
- mysql> create user 'ecomp_sdk_user'@'localhost' identified by 'ecomp_sdk_pass';
- Create a database, for example 'ecomp_sdk':
- mysql> create database 'ecomp_sdk';
Grant access to the newly created database. For example, if the database is created with the name of ‘ecomp_sdk’, login as root to your MySQL instance and grant full privileges on the database you created. Depending on your distribution, the command will look something like this:
mysql> grant all on ecomp_sdk.* to ‘ecomp_sdk_user’@'localhost';
Populate the database by first running the DDL and then DML scripts provided in folder db-scripts. There are 6 scripts included that can be used for SDK; only one DDL and one DML file is necessary at one time. Please see the table below to see which scripts your instance needs. You will need to revise the scripts to use the database name you chose above; all scripts use the database name "ecomp_sdk". For example:
- mysql> source EcompSdkDDLMySql.sql;
- mysql> source EcompSdkDMLMySql.sql
ECOMP SDK File Name | Purpose |
---|---|
EcompSdkDDLMySql.sql | Creates all tables required by the SDK web application. Use this when creating a new database. |
EcompSdkDDL_(verNNNN)_Add.sql | Adds tables required by the SDK web application for the specified release; e.g., 1610. Use this when upgrading from a previous release. |
EcompSdkDMLMySql.sql | Populates tables with all data required by the SDK web application. Use this when creating a new database. |
EcompSdkDML_(verNNNN)_Add.sql | Adds and modifies data rows used by the SDK web application for the specified release; e.g., 1610. Use this when upgrading from a previous release. |
EcompSdkTestDML.sql | Adds data rows that may help for testing the SDK web application. Partner applications should modify this to suit testing needs. |
cleanup_EcompSdk.sql | Removes tables and keys created in the original Fusion script (previous releases) that are no longer used. Alters some columns to reduce their sizes. Use this to clean up very old versions of the database. |
Eclipse Project/Tomcat configuration/startup
- Edit the WEB-INF/conf/system.properties file with the database information. Make sure all the entries point to your local environment and a working accessible database.
db.connectionURL = jdbc:mysql://<mysql-host>:<port>/<db-name>
db.userName = mysql-user
db.password = password
- Edit the the log4j.properties file (WEB-INF/conf/log4j.properties file) and update the property "log4j.appender.logfile.File" to reflect the local environment;
- Add a Tomcat Server instance
- Click on Add / Remove on Tomcat instance you have added and add the project to it.
- Right click on the tomcat and start.
- As with most Eclipse based web applications, it is always a good idea to clean your project from all places. ( Project → Clean, Tomcat → Clean, Clean Tomcat working directory etc.)
- Once your application is up and running, if you have made suitable entries in the FN_USER table as discussed above in "Database Setup", you can open a browser with the URL: http://<host>:<port>/<context>/login_external.htm url and use the credentials stored in that table to login. This is helpful for development, but must NEVER be used in production.
Project Customization
The SDK-App distribution should be customized with the appropriate application name in these locations:
- File pom.xml: groupId, artifactId
- File src/main/resources/logback.xml: componentName
- File src/main/webapp/WEB-INF/web.xml: display-name
- File src/main/webapp/WEB-INF/conf/system.properties: app_display_name