Newer
Older
marking / src / dao / MarkingProperties.java
package dao;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import javax.swing.JOptionPane;

/**
 *
 * @author mark
 */
@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");
	}

	public static String reportPath() {
		return properties.getProperty("report.dir");
	}

	public static String attachmentEmailName() {
		return properties.getProperty("attachment.email.name");
	}

	public static String attachmentFilePrefix() {
		return properties.getProperty("attachment.file.prefix");
	}

	public static String assessmentDescription() {
		return properties.getProperty("assessment.description");
	}

	public static Boolean isEmailEnabled() {
		return properties.getProperty("enable.email").trim().equalsIgnoreCase("true");
	}

	public static String idType() {
		return properties.getProperty("id.type");
	}

	public static String smtpHost() {
		return properties.getProperty("smtp.host");
	}

	public static String smtpUserName() {
		return properties.getProperty("smtp.user.name");
	}

	public static String markerName() {
		return properties.getProperty("marker.name");
	}

	public static String markerEmail() {
		return properties.getProperty("marker.email");
	}

	public static Integer smtpPort() {
		return new Integer(properties.getProperty("smtp.port"));
	}

	public static String reportTitle() {
		return properties.getProperty("report.title");
	}

	public static String reportFooter() {
		return properties.getProperty("report.footer");
	}

	public static String paperCode() {
		return properties.getProperty("paper.code");
	}

}