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

edu.uvm.ccts.common.db.DomainCredentialRegistry Maven / Gradle / Ivy

Go to download

A library of useful generic objects and tools consolidated here to simplify all UVM CCTS projects

There is a newer version: 1.1.5
Show newest version
/*
 * Copyright 2015 The University of Vermont and State
 * Agricultural College.  All rights reserved.
 *
 * Written by Matthew B. Storer 
 *
 * This file is part of CCTS Common.
 *
 * CCTS Common is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * CCTS Common is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with CCTS Common.  If not, see .
 */

package edu.uvm.ccts.common.db;

import edu.uvm.ccts.common.model.Credentials;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by mstorer on 11/4/14.
 */
public class DomainCredentialRegistry {
    private static DomainCredentialRegistry registry = null;

    public static DomainCredentialRegistry getInstance() {
        if (registry == null) {
            registry = new DomainCredentialRegistry();
        }
        return registry;
    }

//////////////////////////////////////////////////////////////////////////////////////

    private Map map = new HashMap();

    private DomainCredentialRegistry() {
    }

    public void register(String domain, Credentials credentials) {
        map.put(domain.toLowerCase(), credentials);
    }

    public boolean isRegistered(String domain) {
        return map.containsKey(domain.toLowerCase());
    }

    public Credentials getCredentials(String domain) {
        return map.get(domain.toLowerCase());
    }

    public void clear() {
        map.clear();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy