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

org.asteriskjava.pbx.PBXFactory Maven / Gradle / Ivy

There is a newer version: 3.41.0
Show newest version
package org.asteriskjava.pbx;

import java.util.concurrent.atomic.AtomicReference;

import org.asteriskjava.pbx.internal.core.AsteriskPBX;

public class PBXFactory
{

    public static PBX getActivePBX()
    {
        return AsteriskPBX.SELF;

    }

    final static AtomicReference profile = new AtomicReference<>();

    public static void init(AsteriskSettings newProfile)
    {
        profile.set(newProfile);
        getActivePBX().performPostCreationTasks();

    }

    public static AsteriskSettings getActiveProfile()
    {
        AsteriskSettings activeProfile = profile.get();
        if (activeProfile == null)
        {
            throw new RuntimeException(
                    "you must call setAsteriskSettings() before getActiveProfile() is called the first time");
        }

        return activeProfile;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy