Multidbs-filesapis2dbs-server

Home

Detailed Description

REST API documentations

This project is maintained by infsci2711

MultiDBs-FilesAPIs2DBs-Server

PROJECT INSTALLATION

1.Logging into the server
Mac:
a.input:
ssh YOURUSERNAME@IP
b.input your password
Windows:
a. download PuTTy
b. In the opened window enter server IP in the host area and leave port 22 as default.
c. Then click open and in the opened window enter your username, hit enter, then enter your password.

2. Preparing Ubuntu
input:
sudo apt-get install maven
sudo apt-get install git
sudo apt-get install openjdk-7-jdk
sudo apt-get install mysql-server
sudo apt-get install nginx


3. Getting the source code to the server
a. Create project and deployed folder under the /opt folder:
cd /opt
sudo mkdir project
cd project
sudo mkdir deployed
cd deployed
sudo mkdir upload

b. Clone all required github repos
cd /opt/project
sudo git clone https://github.com/infsci2711/MultiDBs-Utils.git
sudo git clone https://github.com/infsci2711/MultiDBs-FilesAPIs2DBs-Server.git
sudo git clone https://github.com/infsci2711/MultiDBs-FilesAPIs2DBs-WebClient.git

c. Serve it with the nginx
cd /usr/share/nginx
sudo rm -R html
sudo ln -sv /opt/project/MultiDBs-FilesAPIs2DBs-WebClient/WebContent html

d. Change the restBaseUrl
"We can do that for you. Otherwise you need to change it in the code."
In /opt/project/MultiDBs-FilesAPIs2DBs-WebClient/WebContent/javascripts/SPSSUpload.js
change the following part according to you IP.
var restBaseUrl = "http://52.0.4.98:7654/";

e. Make your MySQL accessible remotely.
cd /etc/mysql
vi my.cnf
change the #bind-address to 0.0.0.0
Save it.

4. Publish your server
cd /opt/project/MultiDBs-FilesAPIs2DBs-Server
sh startup.sh
sh mvnInstall.sh

5. Congratulations, you have published you own SPSS file upload and download system.

PROJECT DESCRIPTION

Generally, our project has three parts, the front end, Dataverse interface and the back end.

The front end is basicly a html page. The html page allows user to upload a SPSS file by form or request a SPSS file from Dataverse. The front end will post the uploaded file to Ubuntu server.

When the user request a file from the Dataverse, our API will post the name of the requested dataset to the Dataverse. Dataverse will generate a URL as a return that our API can use RESTful to get the meta data of the requested dataset. The meta data we needed is the ID of the dataset. Our API will read the ID and make a new request to the Dataverse using this ID. By submittin this ID, Dataverse will return the desired file to our API and the API will uploaded the file to the Ubuntu server to wait for next command.

The back end is the file handling part. Firstly, the SPSS reader in the back end will parse the file to an arraylist and recognize the form name, row name and the column name. In order to make sure all data is store correctly, we store all data as string. Our file reader will re-build the dataset that putting every data in right format. And the API will patch up a SQL to create a new table and record the data in our database in Ubuntu server base on the disposed data.

Due to limitation of time, our project only have handle SPSS file at this time. But it has the potential of reading all file types and store the data to the database.

Any other group which need convert a SPSS file to readable data in server can use our API. Or any user wants to request data from Dataverse is highly recommanded to use our API.

To start our project, developers need an account of Ubuntu server and knowledge of request to RESTful web service that can communicate with Dataverse.

Any updates in our project need to use the mvnInstall.sh script in the MultiDBsFilesAPIs2DBsServerAPI/target. Just simply cd to the location and use sh mvnInshall.sh command to run the script. From the fresh installation, user need to run the startup.sh script in the same directory to initialize the Ubuntu server.