Example usage for org.apache.commons.configuration Configuration getBoolean

List of usage examples for org.apache.commons.configuration Configuration getBoolean

Introduction

In this page you can find the example usage for org.apache.commons.configuration Configuration getBoolean.

Prototype

Boolean getBoolean(String key, Boolean defaultValue);

Source Link

Document

Get a Boolean associated with the given configuration key.

Usage

From source file:org.mobicents.servlet.restcomm.telephony.CallManager.java

private void outboundToPstn(final CreateCall request, final ActorRef sender) throws ServletParseException {
    final String uri = activeProxy;
    SipURI outboundIntf = null;/*from  w  w w.  j  a va2  s . com*/
    SipURI from = null;
    SipURI to = null;

    final Configuration runtime = configuration.subset("runtime-settings");
    final boolean useLocalAddressAtFromHeader = runtime.getBoolean("use-local-address", false);

    final String proxyUsername = (request.username() != null) ? request.username() : activeProxyUsername;

    if (uri != null) {
        try {
            to = sipFactory.createSipURI(request.to(), uri);
            String transport = (to.getTransportParam() != null) ? to.getTransportParam() : "udp";
            outboundIntf = outboundInterface(transport);
            final boolean outboudproxyUserAtFromHeader = runtime.subset("outbound-proxy")
                    .getBoolean("outboudproxy-user-at-from-header");
            if (request.from() != null && request.from().contains("@")) {
                // https://github.com/Mobicents/RestComm/issues/150 if it contains @ it means this is a sip uri and we allow
                // to use it directly
                from = (SipURI) sipFactory.createURI(request.from());
            } else if (useLocalAddressAtFromHeader) {
                from = sipFactory.createSipURI(request.from(), mediaExternalIp + ":" + outboundIntf.getPort());
            } else {
                if (outboudproxyUserAtFromHeader) {
                    // https://telestax.atlassian.net/browse/RESTCOMM-633. Use the outbound proxy username as the userpart
                    // of the sip uri for the From header
                    from = (SipURI) sipFactory.createSipURI(proxyUsername, uri);
                } else {
                    from = sipFactory.createSipURI(request.from(), uri);
                }
            }
            if (((SipURI) from).getUser() == null || ((SipURI) from).getUser() == "") {
                if (uri != null) {
                    from = sipFactory.createSipURI(request.from(), uri);
                } else {
                    from = (SipURI) sipFactory.createURI(request.from());
                }
            }
        } catch (Exception exception) {
            sender.tell(new CallManagerResponse<ActorRef>(exception, this.createCallRequest), self());
        }
        if (from == null || to == null) {
            //In case From or To are null we have to cancel outbound call and hnagup initial call if needed
            final String errMsg = "From and/or To are null, we cannot proceed to the outbound call to: "
                    + request.to();
            logger.error(errMsg);
            sender.tell(
                    new CallManagerResponse<ActorRef>(new NullPointerException(errMsg), this.createCallRequest),
                    self());
        } else {
            sender.tell(new CallManagerResponse<ActorRef>(createOutbound(request, from, to, false)), self());
        }
    } else {
        String errMsg = "Cannot create call to: " + request.to()
                + ". The Active Outbound Proxy is null. Please check configuration";
        logger.error(errMsg);
        sendNotification(errMsg, 11008, "error", true);
        sender.tell(new CallManagerResponse<ActorRef>(new NullPointerException(errMsg), this.createCallRequest),
                self());
    }
}

From source file:org.mobicents.servlet.restcomm.tts.AttSpeechSynthesizer.java

public AttSpeechSynthesizer(final Configuration configuration) {
    super();/*  w  ww .  ja  va2 s .  c  o  m*/
    men = new ConcurrentHashMap<String, String>();
    women = new ConcurrentHashMap<String, String>();
    load(configuration);
    rootDir = configuration.getString("tts-client-directory");
    player = new ClientPlayer(rootDir, configuration.getString("host"), configuration.getInt("port", 7000));
    player.Verbose = configuration.getBoolean("verbose-output", false);
}

From source file:org.mot.common.tools.EmailFactory.java

public EmailFactory() {

    Configuration emailProps;
    try {/* w w  w  .  j  a  v a2  s  .com*/
        emailProps = new PropertiesConfiguration(pf.getConfigDir() + "/email.properties");

        enabled = emailProps.getBoolean("email.enabled", true);
        from = emailProps.getString("email.sender", "info@myopentrader.org");
        rcpt = emailProps.getString("email.recipient", "stephan@myopentrader.org");
        host = emailProps.getString("email.smtp.host", "localhost");

        // Get system properties
        Properties properties = System.getProperties();

        // Setup mail server
        properties.setProperty("mail.smtp.host", host);

        session = Session.getDefaultInstance(properties);

    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:org.mot.core.MyOpenTraderCore.java

/**
 * This is the main starting point for the CORE class. From here all other subclasses are initiated and triggered. 
 * Make sure to be careful about changes in here!
 * /*from  www . j a v a 2s. c  om*/
 * @param PathToConfigDir - provide a configuration directory to use
 * @param name - the executor name
 */
protected void startWorkers(String PathToConfigDir, String name) {

    // First make sure to set the config directory
    pf.setConfigDir(PathToConfigDir);

    try {
        // Read in the properties
        Configuration genericProperties = new PropertiesConfiguration(PathToConfigDir + "/config.properties");

        // Make sure to set the global property and initiate logging
        PropertyConfigurator.configure(pf.getConfigDir() + "/log4j.properties");
        logger.debug("Setting PathToCoreConfigDir property to: " + PathToConfigDir);

        // If the executor is left empty, use wildcard ALL instead.
        if (name == null) {
            // Get the engine name
            name = genericProperties.getString("engine.core.name", "ALL");
        }

        // Start the tick message listener
        if (genericProperties.getBoolean("engine.startup.core.tickListener.enabled", true)) {
            startIndiviualTickMessageListener(name, genericProperties);
        }
        ;

        // Start the tick size listener
        if (genericProperties.getBoolean("engine.startup.core.tickSizeListener.enabled", true)) {
            startTickSizeListener();
        }
        ;

        // Start the tick history listener
        if (genericProperties.getBoolean("engine.startup.core.historyListener.enabled", true)) {
            startTickMessageHistoryListener();
        }
        ;

        // Start the internal scheduling engine
        startScheduler(name);

    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:org.mot.core.MyOpenTraderCore.java

/**
 * This method is just a wrapper to start each tick message listener individually.
 * Each stock will therefore have its own dedicated tickChannel listener - this prevents bottlenecks in the messsaging layer 
 * /*ww  w.  j  ava2  s.  co  m*/
 * @param name - The executor name
 * @param genericProperties - pass in the generic properties
 */
private void startIndiviualTickMessageListener(String name, Configuration genericProperties) {

    WatchListDAO wld = new WatchListDAO();
    final WatchList[] wl = wld.getWatchlistByExecutorAsObject(name);

    for (int u = 0; u < wl.length; u++) {
        String symbol = wl[u].getSymbol();
        String type = wl[u].getType();
        String currency = wl[u].getCurrency();

        // Check if the CEP Engine is supposed to be started... it only makes sense to start the engine, if the tick feed was also started!
        if (genericProperties.getBoolean("engine.startup.core.enabled", true)) {
            createOrdersForStrategies(genericProperties, symbol);
        }
        ;

        startTickMessageListener(symbol, type, currency, genericProperties);

    }
}

From source file:org.restcomm.connect.commons.push.PushNotificationServerHelper.java

public PushNotificationServerHelper(final ActorSystem actorSystem, final Configuration configuration) {
    this.dispatcher = actorSystem.dispatchers().lookup("restcomm-blocking-dispatcher");

    final Configuration runtime = configuration.subset("runtime-settings");
    this.pushNotificationServerEnabled = runtime.getBoolean("push-notification-server-enabled", false);
    if (this.pushNotificationServerEnabled) {
        this.pushNotificationServerUrl = runtime.getString("push-notification-server-url");
        this.pushNotificationServerDelay = runtime.getLong("push-notification-server-delay");
    }// w  w w. j  a  v  a 2  s  . c  o m
}

From source file:org.restcomm.connect.telephony.Call.java

public Call(final SipFactory factory, final ActorRef mediaSessionController, final Configuration configuration,
        final URI statusCallback, final String statusCallbackMethod, final List<String> statusCallbackEvent,
        Map<String, ArrayList<String>> headers) {
    super();//w w  w . j  a  v  a 2 s. c  om
    final ActorRef source = self();
    this.system = context().system();
    this.statusCallback = statusCallback;
    this.statusCallbackMethod = statusCallbackMethod;
    this.statusCallbackEvent = statusCallbackEvent;
    if (statusCallback != null) {
        downloader = downloader();
    }

    this.extensionHeaders = new HashMap<String, ArrayList<String>>();
    if (headers != null) {
        this.extensionHeaders = headers;
    }

    // States for the FSM
    this.uninitialized = new State("uninitialized", null, null);
    this.initializing = new State("initializing", new Initializing(source), null);
    this.waitingForAnswer = new State("waiting for answer", new WaitingForAnswer(source), null);
    this.queued = new State("queued", new Queued(source), null);
    this.ringing = new State("ringing", new Ringing(source), null);
    this.failingBusy = new State("failing busy", new FailingBusy(source), null);
    this.busy = new State("busy", new Busy(source), null);
    this.notFound = new State("not found", new NotFound(source), null);
    //This time the --new Canceling(source)-- is an ActionOnState. Overloaded constructor is used here
    this.canceling = new State("canceling", new Canceling(source));
    this.canceled = new State("canceled", new Canceled(source), null);
    this.failingNoAnswer = new State("failing no answer", new FailingNoAnswer(source), null);
    this.noAnswer = new State("no answer", new NoAnswer(source), null);
    this.dialing = new State("dialing", new Dialing(source), null);
    this.updatingMediaSession = new State("updating media session", new UpdatingMediaSession(source), null);
    this.inProgress = new State("in progress", new InProgress(source), null);
    this.joining = new State("joining", new Joining(source), null);
    this.leaving = new State("leaving", new Leaving(source), null);
    this.stopping = new State("stopping", new Stopping(source), null);
    this.completed = new State("completed", new Completed(source), null);
    this.failed = new State("failed", new Failed(source), null);
    this.inDialogRequest = new State("InDialogRequest", new InDialogRequest(source), null);

    // Transitions for the FSM
    final Set<Transition> transitions = new HashSet<Transition>();
    transitions.add(new Transition(this.uninitialized, this.ringing));
    transitions.add(new Transition(this.uninitialized, this.queued));
    transitions.add(new Transition(this.uninitialized, this.canceled));
    transitions.add(new Transition(this.uninitialized, this.completed));
    transitions.add(new Transition(this.queued, this.canceled));
    transitions.add(new Transition(this.queued, this.initializing));
    transitions.add(new Transition(this.ringing, this.busy));
    transitions.add(new Transition(this.ringing, this.notFound));
    transitions.add(new Transition(this.ringing, this.canceling));
    transitions.add(new Transition(this.ringing, this.canceled));
    transitions.add(new Transition(this.ringing, this.failingNoAnswer));
    transitions.add(new Transition(this.ringing, this.failingBusy));
    transitions.add(new Transition(this.ringing, this.noAnswer));
    transitions.add(new Transition(this.ringing, this.initializing));
    transitions.add(new Transition(this.ringing, this.updatingMediaSession));
    transitions.add(new Transition(this.ringing, this.completed));
    transitions.add(new Transition(this.ringing, this.stopping));
    transitions.add(new Transition(this.ringing, this.failed));
    transitions.add(new Transition(this.initializing, this.canceling));
    transitions.add(new Transition(this.initializing, this.dialing));
    transitions.add(new Transition(this.initializing, this.failed));
    transitions.add(new Transition(this.initializing, this.inProgress));
    transitions.add(new Transition(this.initializing, this.waitingForAnswer));
    transitions.add(new Transition(this.initializing, this.stopping));
    transitions.add(new Transition(this.waitingForAnswer, this.inProgress));
    transitions.add(new Transition(this.waitingForAnswer, this.joining));
    transitions.add(new Transition(this.waitingForAnswer, this.canceling));
    transitions.add(new Transition(this.waitingForAnswer, this.completed));
    transitions.add(new Transition(this.waitingForAnswer, this.stopping));
    transitions.add(new Transition(this.dialing, this.canceling));
    transitions.add(new Transition(this.dialing, this.stopping));
    transitions.add(new Transition(this.dialing, this.failingBusy));
    transitions.add(new Transition(this.dialing, this.ringing));
    transitions.add(new Transition(this.dialing, this.failed));
    transitions.add(new Transition(this.dialing, this.failingNoAnswer));
    transitions.add(new Transition(this.dialing, this.noAnswer));
    transitions.add(new Transition(this.dialing, this.updatingMediaSession));
    transitions.add(new Transition(this.inProgress, this.stopping));
    transitions.add(new Transition(this.inProgress, this.joining));
    transitions.add(new Transition(this.inProgress, this.leaving));
    transitions.add(new Transition(this.inProgress, this.failed));
    transitions.add(new Transition(this.inProgress, this.inDialogRequest));
    transitions.add(new Transition(this.joining, this.inProgress));
    transitions.add(new Transition(this.joining, this.stopping));
    transitions.add(new Transition(this.joining, this.failed));
    transitions.add(new Transition(this.leaving, this.inProgress));
    transitions.add(new Transition(this.leaving, this.stopping));
    transitions.add(new Transition(this.leaving, this.failed));
    transitions.add(new Transition(this.leaving, this.completed));
    transitions.add(new Transition(this.canceling, this.canceled));
    transitions.add(new Transition(this.canceling, this.completed));
    transitions.add(new Transition(this.failingBusy, this.busy));
    transitions.add(new Transition(this.failingNoAnswer, this.noAnswer));
    transitions.add(new Transition(this.failingNoAnswer, this.canceling));
    transitions.add(new Transition(this.updatingMediaSession, this.inProgress));
    transitions.add(new Transition(this.updatingMediaSession, this.failed));
    transitions.add(new Transition(this.stopping, this.completed));
    transitions.add(new Transition(this.stopping, this.failed));
    transitions.add(new Transition(this.failed, this.completed));
    transitions.add(new Transition(this.completed, this.stopping));
    transitions.add(new Transition(this.completed, this.failed));

    // FSM
    this.fsm = new FiniteStateMachine(this.uninitialized, transitions);

    // SIP runtime stuff.
    this.factory = factory;

    // Conferencing
    this.conferencing = false;

    // Media Session Control runtime stuff.
    this.msController = mediaSessionController;
    this.fail = false;

    // Initialize the runtime stuff.
    this.id = Sid.generate(Sid.Type.CALL);
    this.instanceId = RestcommConfiguration.getInstance().getMain().getInstanceId();
    this.created = DateTime.now();
    this.observers = Collections.synchronizedList(new ArrayList<ActorRef>());
    this.receivedBye = false;

    // Media Group runtime stuff
    this.liveCallModification = false;
    this.recording = false;
    this.configuration = configuration;
    final Configuration runtime = this.configuration.subset("runtime-settings");
    this.disableSdpPatchingOnUpdatingMediaSession = runtime
            .getBoolean("disable-sdp-patching-on-updating-mediasession", false);
    this.enable200OkDelay = runtime.getBoolean("enable-200-ok-delay", false);
    if (!runtime.subset("ims-authentication").isEmpty()) {
        final Configuration imsAuthentication = runtime.subset("ims-authentication");
        this.actAsImsUa = imsAuthentication.getBoolean("act-as-ims-ua");
    }
}

From source file:org.restcomm.connect.telephony.CallManager.java

private boolean proxyOut(SipServletRequest request, Client client, String toUser, String toHost,
        String toHostIpAddress, String toPort, SipURI outboundIntf, String proxyURI, String proxyUsername,
        String proxyPassword, SipURI from, SipURI to, boolean callToSipUri) throws UnknownHostException {
    final Configuration runtime = configuration.subset("runtime-settings");
    final boolean useLocalAddressAtFromHeader = runtime.getBoolean("use-local-address", false);
    final boolean outboudproxyUserAtFromHeader = runtime.subset("outbound-proxy")
            .getBoolean("outboudproxy-user-at-from-header", true);

    final String fromHost = ((SipURI) request.getFrom().getURI()).getHost();
    final String fromHostIpAddress = InetAddress.getByName(fromHost).getHostAddress();
    //                    final String fromPort = String.valueOf(((SipURI) request.getFrom().getURI()).getPort()).equalsIgnoreCase("-1") ? "5060"
    //                            : String.valueOf(((SipURI) request.getFrom().getURI()).getHost());

    if (logger.isInfoEnabled()) {
        logger.info("fromHost: " + fromHost + "fromHostIP: " + fromHostIpAddress + "myHostIp: " + myHostIp
                + " mediaExternalIp: " + mediaExternalIp + " toHost: " + toHost + " toHostIP: "
                + toHostIpAddress + " proxyUri: " + proxyURI);
    }//www .  jav  a 2 s .  c om
    if ((myHostIp.equalsIgnoreCase(toHost) || mediaExternalIp.equalsIgnoreCase(toHost))
            || (myHostIp.equalsIgnoreCase(toHostIpAddress) || mediaExternalIp.equalsIgnoreCase(toHostIpAddress))
            // https://github.com/RestComm/Restcomm-Connect/issues/1357
            || (fromHost.equalsIgnoreCase(toHost) || fromHost.equalsIgnoreCase(toHostIpAddress))
            || (fromHostIpAddress.equalsIgnoreCase(toHost)
                    || fromHostIpAddress.equalsIgnoreCase(toHostIpAddress))) {
        if (logger.isInfoEnabled()) {
            logger.info("Call to NUMBER.  myHostIp: " + myHostIp + " mediaExternalIp: " + mediaExternalIp
                    + " toHost: " + toHost + " proxyUri: " + proxyURI);
        }
        try {
            if (useLocalAddressAtFromHeader) {
                if (outboudproxyUserAtFromHeader) {
                    from = (SipURI) sipFactory.createSipURI(proxyUsername,
                            mediaExternalIp + ":" + outboundIntf.getPort());
                } else {
                    from = sipFactory.createSipURI(((SipURI) request.getFrom().getURI()).getUser(),
                            mediaExternalIp + ":" + outboundIntf.getPort());
                }
            } else {
                if (outboudproxyUserAtFromHeader) {
                    // https://telestax.atlassian.net/browse/RESTCOMM-633. Use the outbound proxy username as
                    // the userpart of the sip uri for the From header
                    from = (SipURI) sipFactory.createSipURI(proxyUsername, proxyURI);
                } else {
                    from = sipFactory.createSipURI(((SipURI) request.getFrom().getURI()).getUser(), proxyURI);
                }
            }
            to = sipFactory.createSipURI(((SipURI) request.getTo().getURI()).getUser(), proxyURI);
        } catch (Exception exception) {
            if (logger.isInfoEnabled()) {
                logger.info("Exception: " + exception);
            }
        }
    } else {
        if (logger.isInfoEnabled()) {
            logger.info("Call to SIP URI. myHostIp: " + myHostIp + " mediaExternalIp: " + mediaExternalIp
                    + " toHost: " + toHost + " proxyUri: " + proxyURI);
        }
        from = sipFactory.createSipURI(((SipURI) request.getFrom().getURI()).getUser(),
                outboundIntf.getHost() + ":" + outboundIntf.getPort());
        to = sipFactory.createSipURI(toUser, toHost + ":" + toPort);
        callToSipUri = true;
    }
    if (B2BUAHelper.redirectToB2BUA(request, client, from, to, proxyUsername, proxyPassword, storage,
            sipFactory, callToSipUri, patchForNatB2BUASessions)) {
        return true;
    }
    return false;
}

From source file:org.restcomm.connect.telephony.CallManager.java

private void outboundToPstn(final CreateCall request, final ActorRef sender) throws ServletParseException {
    final String uri = (request.getOutboundProxy() != null && (!request.getOutboundProxy().isEmpty()))
            ? request.getOutboundProxy()
            : activeProxy;//from  w w w .j av  a  2  s  .  c o  m
    SipURI outboundIntf = null;
    SipURI from = null;
    SipURI to = null;

    final Configuration runtime = configuration.subset("runtime-settings");
    final boolean useLocalAddressAtFromHeader = runtime.getBoolean("use-local-address", false);

    final String proxyUsername = (request.username() != null) ? request.username() : activeProxyUsername;

    if (uri != null) {
        try {
            to = sipFactory.createSipURI(request.to(), uri);
            String transport = (to.getTransportParam() != null) ? to.getTransportParam() : "udp";
            outboundIntf = outboundInterface(transport);
            final boolean outboudproxyUserAtFromHeader = runtime.subset("outbound-proxy")
                    .getBoolean("outboudproxy-user-at-from-header");
            if (request.from() != null && request.from().contains("@")) {
                // https://github.com/Mobicents/RestComm/issues/150 if it contains @ it means this is a sip uri and we allow
                // to use it directly
                from = (SipURI) sipFactory.createURI(request.from());
            } else if (useLocalAddressAtFromHeader) {
                from = sipFactory.createSipURI(request.from(), mediaExternalIp + ":" + outboundIntf.getPort());
            } else {
                if (outboudproxyUserAtFromHeader) {
                    // https://telestax.atlassian.net/browse/RESTCOMM-633. Use the outbound proxy username as the userpart
                    // of the sip uri for the From header
                    from = (SipURI) sipFactory.createSipURI(proxyUsername, uri);
                } else {
                    from = sipFactory.createSipURI(request.from(), uri);
                }
            }
            if (((SipURI) from).getUser() == null || ((SipURI) from).getUser() == "") {
                if (uri != null) {
                    from = sipFactory.createSipURI(request.from(), uri);
                } else {
                    from = (SipURI) sipFactory.createURI(request.from());
                }
            }
        } catch (Exception exception) {
            sender.tell(new CallManagerResponse<ActorRef>(exception, this.createCallRequest), self());
        }
        if (from == null || to == null) {
            //In case From or To are null we have to cancel outbound call and hnagup initial call if needed
            final String errMsg = "From and/or To are null, we cannot proceed to the outbound call to: "
                    + request.to();
            logger.warning(errMsg);
            sender.tell(
                    new CallManagerResponse<ActorRef>(new NullPointerException(errMsg), this.createCallRequest),
                    self());
        } else {
            sender.tell(new CallManagerResponse<ActorRef>(createOutbound(request, from, to, false)), self());
        }
    } else {
        String errMsg = "Cannot create call to: " + request.to()
                + ". The Active Outbound Proxy is null. Please check configuration";
        logger.warning(errMsg);
        sendNotification(errMsg, 11008, "error", true);
        sender.tell(new CallManagerResponse<ActorRef>(new NullPointerException(errMsg), this.createCallRequest),
                self());
    }
}

From source file:org.roda.core.RodaCoreFactory.java

/**
 * Start ApacheDS.//from  w ww . ja  v a  2 s.  c o  m
 */
private static void startApacheDS() {
    rodaApacheDSDataDirectory = RodaCoreFactory.getDataPath().resolve(RodaConstants.CORE_LDAP_FOLDER);

    try {
        final Configuration rodaConfig = RodaCoreFactory.getRodaConfiguration();

        final boolean ldapStartServer = rodaConfig.getBoolean("ldap.startServer", false);
        final int ldapPort = rodaConfig.getInt("ldap.port", RodaConstants.CORE_LDAP_DEFAULT_PORT);
        final String ldapBaseDN = rodaConfig.getString("ldap.baseDN", "dc=roda,dc=org");
        final String ldapPeopleDN = rodaConfig.getString("ldap.peopleDN", "ou=users,dc=roda,dc=org");
        final String ldapGroupsDN = rodaConfig.getString("ldap.groupsDN", "ou=groups,dc=roda,dc=org");
        final String ldapRolesDN = rodaConfig.getString("ldap.rolesDN", "ou=groups,dc=roda,dc=org");
        final String ldapAdminDN = rodaConfig.getString("ldap.adminDN", "ou=groups,dc=roda,dc=org");
        final String ldapAdminPassword = rodaConfig.getString("ldap.adminPassword", "roda");
        final String ldapPasswordDigestAlgorithm = rodaConfig.getString("ldap.passwordDigestAlgorithm", "MD5");
        final List<String> ldapProtectedUsers = RodaUtils.copyList(rodaConfig.getList("ldap.protectedUsers"));
        final List<String> ldapProtectedGroups = RodaUtils.copyList(rodaConfig.getList("ldap.protectedGroups"));
        final String rodaGuestDN = rodaConfig.getString("ldap.rodaGuestDN",
                "uid=guest,ou=users,dc=roda,dc=org");
        final String rodaAdminDN = rodaConfig.getString("ldap.rodaAdminDN",
                "uid=admin,ou=users,dc=roda,dc=org");
        final String rodaAdministratorsDN = rodaConfig.getString("ldap.rodaAdministratorsDN",
                "cn=administrators,ou=groups,dc=roda,dc=org");

        RodaCoreFactory.ldapUtility = new LdapUtility(ldapStartServer, ldapPort, ldapBaseDN, ldapPeopleDN,
                ldapGroupsDN, ldapRolesDN, ldapAdminDN, ldapAdminPassword, ldapPasswordDigestAlgorithm,
                ldapProtectedUsers, ldapProtectedGroups, rodaGuestDN, rodaAdminDN, rodaApacheDSDataDirectory);
        ldapUtility.setRODAAdministratorsDN(rodaAdministratorsDN);

        UserUtility.setLdapUtility(ldapUtility);

        if (!FSUtils.exists(rodaApacheDSDataDirectory)) {
            Files.createDirectories(rodaApacheDSDataDirectory);
            final List<String> ldifFileNames = Arrays.asList("users.ldif", "groups.ldif", "roles.ldif");
            final List<String> ldifs = new ArrayList<>();
            for (String ldifFileName : ldifFileNames) {
                final InputStream ldifInputStream = RodaCoreFactory
                        .getConfigurationFileAsStream(RodaConstants.CORE_LDAP_FOLDER + "/" + ldifFileName);
                ldifs.add(IOUtils.toString(ldifInputStream, RodaConstants.DEFAULT_ENCODING));
                RodaUtils.closeQuietly(ldifInputStream);
            }

            RodaCoreFactory.ldapUtility.initDirectoryService(ldifs);
            indexUsersAndGroupsFromLDAP();
        } else {
            RodaCoreFactory.ldapUtility.initDirectoryService();
        }

        createRoles(rodaConfig);
        indexUsersAndGroupsFromLDAP();

    } catch (final Exception e) {
        LOGGER.error("Error starting up embedded ApacheDS", e);
        instantiatedWithoutErrors = false;
    }

}