All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.chimpcentral.archive.LoggerInfo Maven / Gradle / Ivy

There is a newer version: 2.5.1
Show newest version
package com.chimpcentral.archive;

import java.util.Arrays;

public class LoggerInfo extends AbstractLoggerOptions implements SearchableOptions {

	private static final String USER_DIR = System.getProperty("user.dir");
	private static final String RESOURCES_DIR = USER_DIR + "/src/main/resources/com/chimpcentral";

	public LoggerInfo() {
		setDefaultInfo();
	}
	
	public LoggerInfo(SearchableOptions userOptions) {
		this();
		setLoggerOptions(userOptions);
	}
	
	public String getResourcesDir() {
		return RESOURCES_DIR;
	}
	
	private LoggerInfo setFilepath() {
		this.filepath = this.getTargetDir() + "/" + this.getFilename(); 
		return this;
	}
	
	private void setDefaultInfo() {
		this
			.setTargetDir(USER_DIR + "/target")
			.setFilename("logs.html")
			.setTitle("CHIMP CENTRAL")
			.setHeading("CHIMP CENTRAL")
			.setSubHeading("Execution Logs")
			.setFilepath();
	}
	
	private void setLoggerOptions(SearchableOptions userOptions) {
		Arrays.asList(UserOption.values()).parallelStream().forEach(e -> {
			if (userOptions.getUserOption(e) != null) this.setUserOption(e, userOptions.getUserOption(e));
		});
		setFilepath();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy