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

com.github.siwenyan.common.LibUser Maven / Gradle / Ivy

There is a newer version: 1.25.a
Show newest version
package com.github.siwenyan.common;

import com.github.siwenyan.profile.ProfileLibraryImpl;

import java.io.File;

public class LibUser extends ProfileLibraryImpl {

    public static final String LIB_USER = "LIB_USER";
    public static final String THE_USER = "theUser";
    
    //reserved user profile keys
    public static final String TEST_HOST_KEY = "testHost";
    public static final String TEST_ENDPOINT_KEY = "testEndpoint";
    public static final String TIME_ZONE_KEY = "timeZone";

    public static final String USER_PREFIX = "user";
    public final static String USER_TITLE = "userTitle";
    public static final String USER_LOGIN_METHOD = "userLoginMethod";
    public static final String USER_USERNAME = "userUsername";
    public static final String USER_PASSWORD = "userPassword";
    public final static String USER_VALIDATION = "userValidation";

    private static LibUser instance;

    public synchronized final static LibUser getInstance() {
        if (null == instance) {
            String relativePathsString = Sys.conf.getProperty(LIB_USER);
            String[] relativePaths = relativePathsString.split(",");
            String[] paths = new String[relativePaths.length];
            for (int i = 0; i < paths.length; i++) {
                File path = Sys.findFile(relativePaths[i]);
                paths[i] = path.getAbsolutePath();
            }
            instance = new LibUser(paths);
            for (String title : instance.getTitles()) {
                WhiteBoard.getInstance().putMap(WhiteBoard.OWNER_GLOBAL, LIB_USER + "_" + title, instance.getObjectByTitle(title), false, false);
            }
        }
        return instance;
    }

    private LibUser(String... paths) {
        super(paths);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy