-
Notifications
You must be signed in to change notification settings - Fork 5
Environment Set up
Netbeans is used as our development environment. Download the 'all' version with the Glassfish web application server included.
Additional configuration
The Checkstyle plugin shows code warnings when the Java code does not adhere to our coding standards.
To install:
- Under the menu
Tools->Plugins
select theSettings
tab. - Add a new source, name="Checkstyle", URL=http://www.sickboy.cz/checkstyle/autoupdate/autoupdate-3.xml
- Under the
Available Plugins
select the two checkstyle plugins (if not there, click theReload Catalog
button).
To configure:
- Under the menu
Tools->Options
, select theMiscellaneous
option tab and then theCheckstyle
tab - Check the
Enable Custom Configuration
checkbox - Set the config file to the
checkstyle.xml
file found at the root of the ROMS project
The organisation and licence (MIT) are built into the maven configuration; Netbeans picks these up automatically, albeit in a buggy way. Apart from that, the encouragement is not to leave your name at the top of the file (default behavior) since that information is available in the VCS.
- Download the MySql Community Server from http://dev.mysql.com/downloads/mysql/ and install it.
- Create a root user, with your password of choice
- Create the ROMS database by
- Open a command window (or terminal window for *nix users)
- Run the database user creation script using:
mysql --user root --password < \path\to\rbc1b\roms\database\000.sql
and enter the root password. - Run the database schema creation script using:
mysql --user root --password < \path\to\rbc1b\roms\database\001.sql
and enter the root password. - Optionally populate some dummy data using
mysql --user root --password < \path\to\rbc1b\roms\database\001-dummy.sql
and enter the root password.
Databases are periodically updated by developers to enable more functionality to work with ROMS and to add new dummy content.
When databases are updated they need to be updated on your local environment. to do this you need to locate the files on your hard drive. You can do this in NetBeans by going to FILES > ROMS > Database and right-clicking, then Properties.
In the Properties panel you'll see a path to the database. Click on the button with three dots (...) to copy the path, which looks something like /Users/you/NetBeansProjects/ROMS/database/000.sql
.
First, log in to Mysql by typing mysql -u root -p
, press Enter and type your MySQL password.
Then, open a Terminal or Command Prompt window and type Source
and paste the path. Do this for each database. The databases need to be updated in a specific order as below:
- 001
- 001-dummy
- 002
- 003
- 003-dummy
- 003-cleanup
- 004
- 004-dummy
- 005
Glassfish is our web application server. We need to configure our database connection using JDBC though [JNDI] (http://www.javaworld.com/jw-01-2000/jw-01-howto.html).
- Download the MySQL JDBC Connector (bin.jar file) from the [MySql website] (http://dev.mysql.com/downloads/connector/j/). Unzip the contents.
- Copy the bin.jar file into the glassfish lib folder. You can find the glass fish installation folder by: in Netbeans, click in the services tab, under
servers->glassfish
server.Right click->properties
and read the domains folder. - Make sure the glass fish server is running. (
servers->glassfish server
,right click->start
). - Go into your Glassfish Administration Console in your browser: localhost:4848.
- On the left side of the Admin Console under Common Tasks: Choose
Resources->JDBC->Connection Pools
. In the main panel, clickNew
. - The name of the JDBC connection Pool is:
mysqlpool
. The Resource Type:javax.sql.DataSource
(from the Drop-down menu) and the Database Vendor:MySql
. After this, click:Next
. - Check the 'Ping Enabled' check-box.
- Set Additional Properties as follows as name-value pairs:
- URL:
jdbc:mysql://localhost:3306/ROMS
- User: Username that you set for your MySQL server instance, e.g. root
- Password: Password of the username given in the 'User' property above.
- DatabaseName:
ROMS
- URL:
- Click the
Finish->Ping
. Hope it's successful! - On the left of Admin Console:
Resources->JDBC->JDBC Resources
. - Click
New
in main panel. - 'JNDI Name' name option:
jdbc/_roms
- Set 'Pool Name' to
mysqlpool
. ClickOK
to finish.
- Click on the
JavaMail Sessions
on the left-side of the admin console and then click onNew…
. - Set the following Properties to the corresponding values:
- JNDI Name:
mail/EdificeMail
- Mail Host:
smtp.gmail.com
- Default User: Use the gmail account
- Default Sender Address: < Same as default user above>
- Description:
- Status: Enabled
- Store Protocol:
imap
- Store Protocol class:
com.sun.mail.imap.IMAPSTore
- Transport Protocol:
smtp
- Transport Protocol Class:
com.sun.mail.smtp.SMTPTransport
- JNDI Name:
- Add the additional properties by clicking on the "Add Property" button. These are name-value pairs:
- mail.smtp.socketFactory.class:
javax.net.ssl.SSLSocketFactory
- mail.smtp.password: the password for the gmail account
- mail.smtp.auth:
true
- mail.smtp.socketFactory.fallback:
false
- mail.smtp.port:
465
- mail.smtp.socketFactory.port:
465
- mail.smtp.socketFactory.class:
Like the previous two subsections, image support in Edifice is carried out by use of a JNDI lookup of the directory in which the JPEG images are stored. To do this, please follow these steps:
- Create a folder or directory somewhere on your computer where you can store these images. You can choose to create a folder or directory (e.g.
volunteer_images
) within your GlassFish folder. But, please make a note of it's absolute path. - Log into the GlassFish Admin console (localhost:4848).
- On the left-hand side of the admin console, Choose
Resources->JNDI->Custom JNDI
. - Click the
New
button to create a new JNDI resource. - Set the following properties to the corresponding values:
- JDNI Name:
jndi/_images_directories
- Resource Type:
java.util.Properties
- Factory class: (Should pre-fill itself once the Resource Type has been set)
org.glassfish.resources.custom.factory.PropertiesFactory
- Status: Set to Enabled.
- JDNI Name:
- In the Additional Properties table at the bottom, click
Add Property
and set the following values:-
Name:
volunteer.images.directory
-
Value: Type in the absolute path to your images folder from your root. e.g. if your images folder was in
/opt/glassfish3/glassfish/domains/domain1/volunteer_images
then you must type:/opt/glassfish3/glassfish/domains/domain1/volunteer_images/
as the value. NOTE: The directory must end with a forward slash / if you are using a Linux or a Mac, *or a backslash * if you are using a Windows machine. e.g.Typical Linux:
/usr/local/glassfish3/glassfish/domains/domain1/volunteer_images/
Typical Mac:
/Applications/NetBeans/glassfish-3.1.2.2/glassfish/domains/domain1/volunteer_images/
Typical Windows:
C:\Users\RodneyMackay\glassfish3\glassfish\domains\domain1\volunteer_images\
-
- Hit the
Save
button. - Restart your GlassFish server.
Certain properties need to be defined using JNDI that the application server can use to lookup. These properties are defined below.
To set-up the JNDI Custom Resource, using the GlassFish administration console:
-
Navigate to JNDI -> Custom Resource page.
-
Click on the new button and define the following:
- JNDI Name: jndi/_edifice_property
- Resource Type: java.util.Properties
- Status: Enabled
- Click on the "Add Property" to add the properties described below.
The following Properties are used in the application:
edifice.url
Description: This is the URL used to access the server. The reason for this is that the GlassFish server only listens on localhost. Using HTTP Request object to retrieve the URL will result in "http://localhost:8080" or whatever the GlassFish server listens on. On local, i.e. your, development server, you can leave it out. On external dev/production servers, it needs to be set to "https://edifice.rbc-lhc.org.uk:9443" for development server and "https://edifice.rbc-lhc.org.uk" for production server.
Example: http://localhost:8080
security.salt
Description: This is the initial security salt used to create security tokens/hash. If this is left out, a default security salt is used. However, this should be set on both development and production server, and should be different, random and changed on a regular interval.
Example: sdlkfjitu8bndlkjdfs901 but please do not use this on any development or production servers.