GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
4
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
mark.george
/
marking
Browse code
Add some extra properties. Clean up props file.
master
1 parent
dc9c05c
commit
e230ddcbf5f5955a91771a09646344d5e759d325
Mark George
authored
on 11 Apr
Patch
Showing
2 changed files
src/main/java/dao/MarkingProperties.java
src/main/resources/marking.properties
Ignore Space
Show notes
View
src/main/java/dao/MarkingProperties.java
package dao; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; import javax.swing.JOptionPane; /** * * @author Mark George <mark.george@otago.ac.nz> */ @SuppressWarnings("StaticNonFinalUsedInInitialization") public class MarkingProperties { private static Properties properties = null; static { if (properties == null) { properties = new Properties(); try { // production properties.load(new FileInputStream("marking.properties")); } catch (IOException ex1) { try { // development properties.load(MarkingProperties.class.getResourceAsStream("/marking.properties")); } catch (IOException ex2) { JOptionPane.showMessageDialog(null, "marking.properties not found!"); } } } } public static String jdbcUri() { return properties.getProperty("jdbc.url").trim(); } public static String reportPath() { return properties.getProperty("report.dir").trim(); } public static String attachmentEmailName() { return properties.getProperty("attachment.email.name").trim(); } public static String attachmentFilePrefix() { return properties.getProperty("attachment.file.prefix").trim(); } public static String assessmentDescription() { return properties.getProperty("assessment.description").trim(); } public static Boolean isEmailEnabled() { return properties.getProperty("enable.email").trim().equalsIgnoreCase("true"); } public static String smtpHost() { return properties.getProperty("smtp.host").trim(); } public static Boolean isTls() { return properties.getProperty("smtp.tls").trim().equalsIgnoreCase("true"); } public static String smtpUserName() { return properties.getProperty("smtp.user.name").trim(); } public static String markerName() { return properties.getProperty("marker.name").trim(); } public static String markerEmail() { return properties.getProperty("marker.email").trim(); } public static String ccEmail() { return properties.getProperty("cc.email").trim(); } public static Integer smtpPort() { return Integer.valueOf(properties.getProperty("smtp.port").trim()); } public static Integer emailDelay() { return Integer.valueOf(properties.getProperty("email.delay").trim()); } public static Boolean reportShowMax() { return properties.getProperty("report.showmax").trim().equalsIgnoreCase("true"); } public static String reportTitle() { return properties.getProperty("report.title").trim(); } public static String reportFooter() { return properties.getProperty("report.footer").trim(); } public static String paperCode() { return properties.getProperty("paper.code").trim(); } public static Integer textAreaFontSize() { return Integer.valueOf(properties.getProperty("textarea.fontsize").trim()); } public static Boolean copyIdToClipboard() { return properties.getProperty("copy.id.to.clipboard").equalsIgnoreCase("true"); } public static Boolean showBonusOnReport() { return properties.getProperty("show.bonus.on.report").equalsIgnoreCase("true"); } }
package dao; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; import javax.swing.JOptionPane; /** * * @author Mark George <mark.george@otago.ac.nz> */ @SuppressWarnings("StaticNonFinalUsedInInitialization") public class MarkingProperties { private static Properties properties = null; static { if (properties == null) { properties = new Properties(); try { // production properties.load(new FileInputStream("marking.properties")); } catch (IOException ex1) { try { // development properties.load(MarkingProperties.class.getResourceAsStream("/marking.properties")); } catch (IOException ex2) { JOptionPane.showMessageDialog(null, "marking.properties not found!"); } } } } public static String jdbcUri() { return properties.getProperty("jdbc.url").trim(); } public static String reportPath() { return properties.getProperty("report.dir").trim(); } public static String attachmentEmailName() { return properties.getProperty("attachment.email.name").trim(); } public static String attachmentFilePrefix() { return properties.getProperty("attachment.file.prefix").trim(); } public static String assessmentDescription() { return properties.getProperty("assessment.description").trim(); } public static Boolean isEmailEnabled() { return properties.getProperty("enable.email").trim().equalsIgnoreCase("true"); } public static String smtpHost() { return properties.getProperty("smtp.host").trim(); } public static Boolean isTls() { return properties.getProperty("smtp.tls").trim().equalsIgnoreCase("true"); } public static String smtpUserName() { return properties.getProperty("smtp.user.name").trim(); } public static String markerName() { return properties.getProperty("marker.name").trim(); } public static String markerEmail() { return properties.getProperty("marker.email").trim(); } public static String ccEmail() { return properties.getProperty("cc.email").trim(); } public static Integer smtpPort() { return Integer.valueOf(properties.getProperty("smtp.port").trim()); } public static Integer emailDelay() { return Integer.valueOf(properties.getProperty("email.delay").trim()); } public static Boolean reportShowMax() { return properties.getProperty("report.showmax").trim().equalsIgnoreCase("true"); } public static String reportTitle() { return properties.getProperty("report.title").trim(); } public static String reportFooter() { return properties.getProperty("report.footer").trim(); } public static String paperCode() { return properties.getProperty("paper.code").trim(); } public static Integer textAreaFontSize() { return Integer.valueOf(properties.getProperty("textarea.fontsize").trim()); } }
Ignore Space
Show notes
View
src/main/resources/marking.properties
jdbc.url=jdbc:h2:./db/testing;IFEXISTS=TRUE;AUTO_SERVER=TRUE # output dir for generated reports report.dir=/tmp/reports # local testing smtp.host=localhost smtp.port=2525 smtp.user.name=n/a smtp.tls=false # real server #smtp.host=smtp.staff.otago.ac.nz #smtp.port=587 #smtp.user.name=geoma48p #smtp.tls=true marker.name=Mark George marker.email=mark.george@otago.ac.nz cc.email=cc@example.com attachment.email.name=testing.pdf attachment.file.prefix=testing assessment.description=Testing # does email button appear in UI enable.email=true # email delay in seconds (rate limiting) email.delay=0 # show maximum on report report.showmax=true report.title=Report Title\nTitle Continued report.footer=Some description of how the marks are calculated. paper.code=INFOXYZ textarea.fontsize = 14 copy.id.to.clipboard = false show.bonus.on.report = false
jdbc.url=jdbc:h2:./db/testing;IFEXISTS=TRUE;AUTO_SERVER=TRUE # output dir for generated reports report.dir=/tmp/reports # local testing smtp.host=localhost smtp.port=2525 smtp.user.name=n/a smtp.tls=false # real server #smtp.host=smtp.staff.otago.ac.nz #smtp.port=587 #smtp.user.name=geoma48p #smtp.tls=true marker.name=Mark George marker.email=mark.george@otago.ac.nz cc.email=cc@example.com attachment.email.name=testing.pdf attachment.file.prefix=testing assessment.description=Testing # does email button appear in UI enable.email=true # email delay in seconds (rate limiting) email.delay=0 # show maximum on report report.showmax=true report.title=Some Report Title\nSecond Line of Titl;e report.footer=Some long winded description of how the marks are calculated. paper.code=INFOXYZ textarea.fontsize = 24
Show line notes below