-
Notifications
You must be signed in to change notification settings - Fork 0
Developers quickstart guide
The Developers quickstart guide contains the initial steps to get up to speed with the development environment used in the CASSANDRA project.
The development tools used in this guide are:
- Eclipse 3.7.2
- Apache Tomcat 7
- MongoDB
- github
Step one is to install MongoDB in Ubuntu:
sudo apt-get install mongodb
Again starting and stopping the service:
sudo service mongodb start
sudo service mongodb stop
One can play with the interactive shell of MongoDB using the command:
mongo
Insert JSON documents via the Java driver: http://www.mkyong.com/mongodb/java-mongodb-convert-json-data-to-dbobject/
Step one is to download MongoDB from from official MongoDB website. Choose Windows version and click on the download link.
Then you must unzip the downloaded MongoDB file to your prefer location, for example : “C:\mongodb“.
You should read the “README” file as well, it contains very useful information.
The third step is the creation of the required data directory since MongoDB won’t create it automatically. So, you need to create a data directory for MongoDB, for example : “C:\mongodbdata“.
Now you are ready to run the MongoDB Server. The “mongod.exe” is the database server, run it and point it to the data directory you created just now, via “--dbpath” argument.
In order to do this you should open the Command Prompt (cmd.exe) with Administrator's Privileges (Run as Administrator in Right Click Menu)
C:\mongodb\bin>mongod --dbpath "c:\mongodbdata"
If everything has gone by the book you should see the next lines in your Command Prompt.
[initandlisten] waiting for connections on port 27017
[websvr] web admin interface listening on port 28017
This means that you can either use the command shell (described below) and run mongo
C:\mongodb\bin>mongo
MongoDB shell version: 1.8.1
connecting to: test
> //Your commands here
or open you can access the mongoDB web interface in
http://127.0.0.1:28017
You have successfully connected to the mongo shell.
In order to add MongoDB as a Windows Service you can issue “mongod –install“, for example :
C:\mongodb\bin>mongod --dbpath "c:\mongodbdata" --logpath "c:\mongodbdata\logs.txt" --install --serviceName "MongoDB"
all output going to: c:\mymongodb\logs.txt
This means that you are creating a Windows Service named "MongoDB" which is utilizing the c:\mongodbdata as database folder and for database logs you utilize the logs.txt in the mongodbdata folder.
Service can be started/stopped from the command line via
net start "MongoDB"
or
net stop "MongoDB"
In order to remove the MongoDB Service you have created
C:\mongodb\bin>mongod --remove --serviceName "MongoDB"
We assume Eclipse is installed in the system. Two plugins will be needed if the classic Eclipse has been installed: a) the Web Tools for bringing Java2EE behavior into the IDE and b) the Egit plugin for bringing Git capabilities into Eclipse.
##Install Egit Read the guidelines
Important notice: We will use Egit plugin for the initial import. This is because Egit does not support the --no-ff
option when merging. Thus git commands via terminal are preferred. Alternatively one can use pull requests for merging the changes. For more information about the git daily grind read Developers Guidelines.
##Install the Web Tools In Eclipse go to:
Help > Install Software ... > In the "Work with:" list select Indigo (you may need to add http://download.eclipse.org/releases/indigo/ ) > Check "Web, XML, Java EE and ..." > Next
The next and final configuration step is to configure Tomcat with Eclipse. Because in the Ubuntu installation the binaries and the configuration files are not in the same place, it is more convenient to download the Tomcat Server and unzip it in a directory.
This installation could be used for production purposes. The first step is to install tomcat. In Ubuntu:
sudo apt-get install tomcat7
In general one can start and stop the tomcat7 service by issuing the following commands in terminal:
sudo service tomcat7 start
sudo service tomcat7 stop
The tomcat7 binaries directory is:
/usr/share/tomcat7
Tomcat7 directories are also found in:
/etc/tomcat7/
/var/lib/tomcat7
After starting Tomcat, go to http://localhost:8080 in your browser to get information about your current installation paths. For more information one can read the Tomcat & Eclipse official FAQ.
In order to install Tomcat in Windows you have to download the latest version from the official Tomcat Site.
The suggested version is the 32-bit/64-bit Windows Service Installer
When the downloading ends, you run the executable installer and follow the procedure to the end (Full Installation).
Tomcat Service can be started/stopped from the command line via
net start "Tomcat7"
or
net stop "Tomcat7"
To test the tomcat installation, enter the following in your web browser:
http://localhost:8080/
If the apache tomcat page shows up, the installation was successful.
- Check out the project using Egit:
File > Import ... > Projects from Git > Clone ... > Copy and paste in the URI textbox the https github URI > add User and Password > Next > Select the develop branch > Select the output directory > Finish > Select the repository > Next > Import existing projects
- Setup the server / Run the application
Right Click on the project > Run as ... > Run on Server > Select the Tomcat v7.0 Server > Add the Tomcat installation directory > Add the cassandra resource to the Configured resources > Finish
- Test
Go to http://localhost:8080/cassandra/rest/project and you should observe a json document
All web content should be placed under the WebContent folder and all Java classes under the src folder. The tests folder will contain scripts for testing the RESTful API.