Skip to content
ConfigObject.java 1.03 KiB
Newer Older
xtof's avatar
xtof committed
/**
xtof's avatar
xtof committed
 *
xtof's avatar
xtof committed
 */
package org.josast.property;

import java.io.File;
import java.util.logging.Logger;

/**
 * @author Christophe
 *
 */
public abstract class ConfigObject {
xtof's avatar
xtof committed

xtof's avatar
xtof committed
	private Logger log = Logger.getLogger("AmsatLogger");
xtof's avatar
xtof committed
	private String ConfigFilename = null;
	private String fullConfigFilename = null;
xtof's avatar
xtof committed
	protected CONFIG ConfigFile = CONFIG.getInstance();

xtof's avatar
xtof committed
	public ConfigObject() {

xtof's avatar
xtof committed
	}
xtof's avatar
xtof committed

	public String getFulFileName() {
		fullConfigFilename = System.getProperty("user.dir") + "/config";
xtof's avatar
xtof committed
    	File apath = new File(fullConfigFilename);
xtof's avatar
xtof committed

    		if (!apath.exists()) {
xtof's avatar
xtof committed
    			boolean res =  apath.mkdir();
xtof's avatar
xtof committed
    			if (!res) {
    				log.severe("fail to create " + fullConfigFilename);
xtof's avatar
xtof committed
    			}
    		}
			return fullConfigFilename;
	}
xtof's avatar
xtof committed
	/**
	 * @param configFilename  Configuration file name
	 */
xtof's avatar
xtof committed
	public ConfigObject(final String configFilename) {
xtof's avatar
xtof committed
		super();
		ConfigFilename = configFilename;
		ConfigFile.setFileName(configFilename);
	}



	/**
	 * @return  Configuration Filename
	 */
	public String getConfigFilename() {
		return ConfigFilename;
	}

}