RuntimeData.java :  » XML » dniesign » dniegp2pclient » Java Open Source

Java Open Source » XML » dniesign 
dniesign » dniegp2pclient » RuntimeData.java
package dniegp2pclient;

import java.io.File;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.gruposp2p.dnie.utils.FileUtils;
import org.gruposp2p.dnie.model.DNIeUser;

/**
 *
 * @author jj
 */
public class RuntimeData {

    private static Logger logger =
            LoggerFactory.getLogger(RuntimeData.class);
    
    private static RuntimeData instance;
    public String signedDocument;
    public String signedDocumentServerUrl = "";
    public DNIeUser user = new DNIeUser();
    public boolean isDNIeLoaded = false;
    public boolean isSignedDocumentLoaded = false;
    public String dniePassword;

    private RuntimeData () {}

    public static RuntimeData getInstance () {
        if (instance == null) {
            instance = new RuntimeData();
            instance.checkFiles();
        }
        return instance;
    }

    private void checkFiles () {
        boolean appDir = new File(FileUtils.APPDIR).mkdir();
        if (appDir) {
            File propertiesFile = new File(FileUtils.PROPERTIES_FILE);
            try {
                propertiesFile.createNewFile();
            } catch (IOException ex) {
                logger.error(ex.getMessage(), ex);
            }
        }
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.