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

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

Introduction

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

Prototype

List getList(String key);

Source Link

Document

Get a List of strings associated with the given configuration key.

Usage

From source file:org.apache.wookie.server.LocaleHandler.java

@SuppressWarnings("unchecked")
private void getLocalesFromConfig(Configuration configuration) {
    List<Locale> localeList = new ArrayList<Locale>();
    List<String> localeStringList = configuration.getList("widget.locales");
    if ((localeStringList != null) && (localeStringList.size() > 0)) {
        for (final String language : localeStringList) {
            localeList.add(new Locale(language));
        }/*w  ww. j a  v  a 2  s . c o m*/
    } else {
        // using default
        localeList.add(new Locale(DEFAULT_LANGUGE));
    }
    fLocales = localeList;
    localeStringList = null;
}

From source file:org.chenillekit.core.tests.TestConfigurationService.java

@Test
public void test2() {
    Resource configResource = new ClasspathResource("test.xml");
    Configuration testConfiguration = service.getConfiguration(configResource);

    String backColor = testConfiguration.getString("colors.background");
    String textColor = testConfiguration.getString("colors.text");
    String linkNormal = testConfiguration.getString("colors.link[@normal]");
    String defColor = testConfiguration.getString("colors.default");
    int rowsPerPage = testConfiguration.getInt("rowsPerPage");
    List buttons = testConfiguration.getList("buttons.name");

    assertNotNull(testConfiguration);//from w w w . j av  a 2  s  . c o  m
    assertEquals(backColor, "#808080");
    assertEquals(textColor, "#000000");
    assertEquals(linkNormal, "#000080");
    assertEquals(defColor, "#008000");
    assertEquals(rowsPerPage, 15);
    assertEquals(buttons.size(), 3);
}

From source file:org.csource.fastdfs.ClientGlobal.java

/**
* load global variables//from ww  w . ja  v  a  2 s .  c  o m
* @param conf_filename config filename
 * @throws ConfigurationException 
*/
public static void init(String conf_filename)
        throws FileNotFoundException, IOException, MyException, ConfigurationException {
    Configuration config;
    config = new PropertiesConfiguration(conf_filename);

    g_connect_timeout = config.getInt("connect_timeout", DEFAULT_CONNECT_TIMEOUT);
    if (g_connect_timeout < 0) {
        g_connect_timeout = DEFAULT_CONNECT_TIMEOUT;
    }
    g_connect_timeout *= 1000; //millisecond

    g_network_timeout = config.getInt("network_timeout", DEFAULT_NETWORK_TIMEOUT);
    if (g_network_timeout < 0) {
        g_network_timeout = DEFAULT_NETWORK_TIMEOUT;
    }
    g_network_timeout *= 1000; //millisecond

    g_charset = config.getString("charset");
    if (g_charset == null || g_charset.length() == 0) {
        g_charset = "ISO8859-1";
    }

    List<Object> trackerServers = config.getList("tracker_server");
    InetSocketAddress[] tracker_servers = new InetSocketAddress[trackerServers.size()];
    String[] parts;

    for (int i = 0; i < trackerServers.size(); i++) {
        parts = ((String) trackerServers.get(i)).split("\\:", 2);
        if (parts.length != 2) {
            throw new MyException(
                    "the value of item \"tracker_server\" is invalid, the correct format is host:port");
        }

        tracker_servers[i] = new InetSocketAddress(parts[0].trim(), Integer.parseInt(parts[1].trim()));
    }
    g_tracker_group = new TrackerGroup(tracker_servers);

    g_tracker_http_port = config.getInt("http.tracker_http_port", 80);
    g_anti_steal_token = config.getBoolean("http.anti_steal_token", false);
    if (g_anti_steal_token) {
        g_secret_key = config.getString("http.secret_key");
    }
    if (trackerServers.size() == 0) {
        throw new MyException("item \"tracker_server\" in " + conf_filename + " not found");
    }

    /*        IniFileReader iniReader;
            String[] szTrackerServers;
             String[] parts;
                     
            iniReader = new IniFileReader(conf_filename);
            
             g_connect_timeout = iniReader.getIntValue("connect_timeout", DEFAULT_CONNECT_TIMEOUT);
            if (g_connect_timeout < 0)
            {
               g_connect_timeout = DEFAULT_CONNECT_TIMEOUT;
            }
            g_connect_timeout *= 1000; //millisecond
                    
            g_network_timeout = iniReader.getIntValue("network_timeout", DEFAULT_NETWORK_TIMEOUT);
            if (g_network_timeout < 0)
            {
               g_network_timeout = DEFAULT_NETWORK_TIMEOUT;
            }
            g_network_timeout *= 1000; //millisecond
            
            g_charset = iniReader.getStrValue("charset");
            if (g_charset == null || g_charset.length() == 0)
            {
               g_charset = "ISO8859-1";
            }
                    
            szTrackerServers = iniReader.getValues("tracker_server");
            if (szTrackerServers == null)
            {
               throw new MyException("item \"tracker_server\" in " + conf_filename + " not found");
            }
                    
            InetSocketAddress[] tracker_servers = new InetSocketAddress[szTrackerServers.length];
            for (int i=0; i<szTrackerServers.length; i++)
            {
               parts = szTrackerServers[i].split("\\:", 2);
               if (parts.length != 2)
               {
      throw new MyException("the value of item \"tracker_server\" is invalid, the correct format is host:port");
               }
                       
               tracker_servers[i] = new InetSocketAddress(parts[0].trim(), Integer.parseInt(parts[1].trim()));
            }
            g_tracker_group = new TrackerGroup(tracker_servers);
                    
            g_tracker_http_port = iniReader.getIntValue("http.tracker_http_port", 80);
            g_anti_steal_token = iniReader.getBoolValue("http.anti_steal_token", false);
            if (g_anti_steal_token)
            {
               g_secret_key = iniReader.getStrValue("http.secret_key");
            }*/

}

From source file:org.eclipse.jubula.documentation.gen.ConfigLoader.java

/**
 * The constructor.//from  w  ww.  j  a  v  a2 s.  c  om
 */
private ConfigLoader() {
    Configuration conf;
    try {
        conf = new PropertiesConfiguration(RESOURCES_TEXGEN_PROPERTIES);
    } catch (ConfigurationException e) {
        throw new IllegalArgumentException(e);
    }
    String[] groups = conf.getStringArray(TEX_GEN_GROUPS);
    for (int i = 0; i < groups.length; i++) {
        String group = groups[i];
        m_groups.add(new ConfigGroup(group, conf));
    }
    m_toolkitConfig = new ToolkitConfig(conf.getString(BASEDIR), conf.getString(XML_PATH),
            conf.getString(RESOURCE_BUNDLE_PATH), conf.getString(RESOURCE_BUNDLE_FQN),
            conf.getString(OUTPUTDIR), conf.getList(TOOLKIT_NAMES));
}

From source file:org.glite.slcs.shibclient.metadata.ShibbolethClientMetadata.java

/**
 * Parses the <ShibbolethClientMetadata> element and return a map of (id,idpObject)
 * @return a Map of (idpID,idpObject)/*w ww  .  ja v  a 2s .  c  om*/
 * @throws SLCSConfigurationException
 */
private Map<String, Provider> parseProviders() throws SLCSConfigurationException {
    Map<String, Provider> entities = new HashMap<String, Provider>();
    LOG.debug("get configuration subset: ShibbolethClientMetadata");
    Configuration metadata = getConfiguration().subset("ShibbolethClientMetadata");
    // external metadata defined with filename= attribute?
    String metadataFilename = metadata.getString("[@filename]");
    LOG.debug("metadata filename=" + metadataFilename);
    String metadataUrl = metadata.getString("[@url]");
    LOG.debug("metadata url=" + metadataUrl);
    if (metadataFilename != null) {
        // load external metadata file       
        try {
            LOG.info("load metadata from file: " + metadataFilename);
            FileConfiguration metadataFileConfiguration = loadConfiguration(metadataFilename);
            metadataSource_ = metadataFileConfiguration.getFile().getAbsolutePath();
            metadata = metadataFileConfiguration;
        } catch (SLCSConfigurationException e) {
            LOG.error("Failed to load external ShibbolethClientMetadata: " + metadataFilename, e);
            throw e;
        }
    }
    // check for metadata url and download
    else if (metadataUrl != null) {
        // download external metadata file
        try {
            URL url = new URL(metadataUrl);
            LOG.info("download metadata from url: " + url);
            // httpclient is used to download the config
            metadata = downloadConfiguration(url);
            metadataSource_ = metadataUrl;
        } catch (MalformedURLException mue) {
            LOG.error("Invalid URL for external ShibbolethClientMetadata: " + metadataUrl, mue);
            throw new SLCSConfigurationException(
                    "ShibbolethClientMetadata url=" + metadataUrl + " parameter is invalid", mue);
        } catch (SLCSConfigurationException sce) {
            LOG.error("Failed to download ShibbolethClientMetadata from: " + metadataUrl, sce);
            throw sce;
        }
    } else {
        LOG.info("inline metadata from: " + getFilename());
        metadataSource_ = getFilename();

    }
    // process metadata
    String name = null;
    String url = null;
    String id = null;
    Configuration config = null;
    // SLCS SP
    config = metadata.subset("ServiceProvider");
    if (!config.isEmpty()) {
        LOG.debug("ServiceProvider element found");
        id = config.getString("[@id]");
        if (id == null || id.equals("")) {
            id = DEFAULT_SLCS_PROVIDERID;
        }
        this.slcsProviderId_ = id;
        name = config.getString("name");
        url = config.getString("url");
        ServiceProvider sp = new ServiceProvider(id, name, url);
        LOG.debug("add " + sp);
        entities.put(id, sp);
    } else {
        throw new SLCSConfigurationException("ServiceProvider element not found in metadata");
    }
    // All IdPs
    Configuration idpsConfig = metadata.subset("IdentityProviders");
    if (idpsConfig.isEmpty()) {
        throw new SLCSConfigurationException("IdentityProviders element not found in metadata");
    }
    List<String> idps = idpsConfig.getList("IdentityProvider[@id]");
    int nIdp = idps.size();
    if (nIdp < 1) {
        throw new SLCSConfigurationException("No IdentityProvider element found in metadata");
    }
    LOG.debug(nIdp + " IdentityProvider elements found");
    for (int i = 0; i < nIdp; i++) {
        config = idpsConfig.subset("IdentityProvider(" + i + ")");
        id = config.getString("[@id]");
        name = config.getString("name");
        url = config.getString("url");
        String authTypeName = config.getString("authentication[@type]");
        String authUrl = config.getString("authentication.url");
        if (authUrl == null) {
            authUrl = url;
        }
        IdentityProvider idp = new IdentityProvider(id, name, url, authTypeName, authUrl);
        // optional entityID for SAML2 support
        String entityID = config.getString("[@entityID]");
        if (entityID != null) {
            idp.setEntityID(entityID);
        }
        if (idp.getAuthType() == IdentityProvider.SSO_AUTHTYPE_CAS
                || idp.getAuthType() == IdentityProvider.SSO_AUTHTYPE_PUBCOOKIE
                || idp.getAuthType() == IdentityProvider.SSO_AUTHTYPE_FORM) {
            // read form name and username and password field names
            String formName = config.getString("authentication.form[@name]", "");
            idp.setAuthFormName(formName);
            String formUsername = config.getString("authentication.form.username");
            idp.setAuthFormUsername(formUsername);
            String formPassword = config.getString("authentication.form.password");
            idp.setAuthFormPassword(formPassword);
        } else {
            // basic or ntlm
            String realm = config.getString("authentication.realm");
            idp.setAuthRealm(realm);
        }
        LOG.debug("add " + idp);
        entities.put(id, idp);
    }
    return entities;
}

From source file:org.j2free.invoker.InvokerFilter.java

/**
 * Internal method for adding a servlet config
 *
 * @param config//from  www  .  j  a v  a  2s  .com
 * @param pathProp
 * @param defaultPath
 * @param servletClass
 */
private synchronized void addServletMapping(Configuration config, String pathProp, String defaultPath,
        Class<? extends HttpServlet> servletClass) {
    String path;
    Class oldKlass;

    Iterator itr;

    List paths = config.getList(pathProp);

    if (paths == null) {
        oldKlass = addServletMapping(defaultPath, servletClass);
        if (oldKlass != null)
            log.error("Error mapping " + servletClass.getSimpleName() + ", " + oldKlass.getSimpleName()
                    + " was alread mapped to " + defaultPath);
    } else {
        itr = paths.iterator();
        while (itr.hasNext()) {
            path = (String) itr.next();
            oldKlass = addServletMapping(path, servletClass);
            if (oldKlass != null)
                log.error("Error mapping " + servletClass.getSimpleName() + ", " + oldKlass.getSimpleName()
                        + " was alread mapped to " + path);
        }
    }
}

From source file:org.lable.oss.dynamicconfig.core.commonsconfiguration.ConcurrentConfigurationTest.java

@Test
public void testMethodWrappers() {
    CombinedConfiguration mockConfiguration = mock(CombinedConfiguration.class);
    Configuration concurrentConfiguration = new ConcurrentConfiguration(mockConfiguration, null);

    concurrentConfiguration.subset("subset");
    concurrentConfiguration.isEmpty();// ww  w.j av  a  2  s.  c  o m
    concurrentConfiguration.containsKey("key");
    concurrentConfiguration.getProperty("getprop");
    concurrentConfiguration.getKeys("getkeys");
    concurrentConfiguration.getKeys();
    concurrentConfiguration.getProperties("getprops");
    concurrentConfiguration.getBoolean("getboolean1");
    concurrentConfiguration.getBoolean("getboolean2", true);
    concurrentConfiguration.getBoolean("getboolean3", Boolean.FALSE);
    concurrentConfiguration.getByte("getbyte1");
    concurrentConfiguration.getByte("getbyte2", (byte) 0);
    concurrentConfiguration.getByte("getbyte3", Byte.valueOf((byte) 0));
    concurrentConfiguration.getDouble("getdouble1");
    concurrentConfiguration.getDouble("getdouble2", 0.2);
    concurrentConfiguration.getDouble("getdouble3", Double.valueOf(0.2));
    concurrentConfiguration.getFloat("getfloat1");
    concurrentConfiguration.getFloat("getfloat2", 0f);
    concurrentConfiguration.getFloat("getfloat3", Float.valueOf(0f));
    concurrentConfiguration.getInt("getint1");
    concurrentConfiguration.getInt("getint2", 0);
    concurrentConfiguration.getInteger("getint3", 0);
    concurrentConfiguration.getLong("getlong1");
    concurrentConfiguration.getLong("getlong2", 0L);
    concurrentConfiguration.getLong("getlong3", Long.valueOf(0L));
    concurrentConfiguration.getShort("getshort1");
    concurrentConfiguration.getShort("getshort2", (short) 0);
    concurrentConfiguration.getShort("getshort3", Short.valueOf((short) 0));
    concurrentConfiguration.getBigDecimal("getbigd1");
    concurrentConfiguration.getBigDecimal("getbigd2", BigDecimal.valueOf(0.4));
    concurrentConfiguration.getBigInteger("getbigi1");
    concurrentConfiguration.getBigInteger("getbigi2", BigInteger.valueOf(2L));
    concurrentConfiguration.getString("getstring1");
    concurrentConfiguration.getString("getstring2", "def");
    concurrentConfiguration.getStringArray("stringarray");
    concurrentConfiguration.getList("getlist1");
    concurrentConfiguration.getList("getlist2", Arrays.asList("a", "b"));

    verify(mockConfiguration, times(1)).subset("subset");
    verify(mockConfiguration, times(1)).isEmpty();
    verify(mockConfiguration, times(1)).containsKey("key");
    verify(mockConfiguration, times(1)).getProperty("getprop");
    verify(mockConfiguration, times(1)).getKeys("getkeys");
    verify(mockConfiguration, times(1)).getKeys();
    verify(mockConfiguration, times(1)).getProperties("getprops");
    verify(mockConfiguration, times(1)).getBoolean("getboolean1");
    verify(mockConfiguration, times(1)).getBoolean("getboolean2", true);
    verify(mockConfiguration, times(1)).getBoolean("getboolean3", Boolean.FALSE);
    verify(mockConfiguration, times(1)).getByte("getbyte1");
    verify(mockConfiguration, times(1)).getByte("getbyte2", (byte) 0);
    verify(mockConfiguration, times(1)).getByte("getbyte3", Byte.valueOf((byte) 0));
    verify(mockConfiguration, times(1)).getDouble("getdouble1");
    verify(mockConfiguration, times(1)).getDouble("getdouble2", 0.2);
    verify(mockConfiguration, times(1)).getDouble("getdouble3", Double.valueOf(0.2));
    verify(mockConfiguration, times(1)).getFloat("getfloat1");
    verify(mockConfiguration, times(1)).getFloat("getfloat2", 0f);
    verify(mockConfiguration, times(1)).getFloat("getfloat3", Float.valueOf(0f));
    verify(mockConfiguration, times(1)).getInt("getint1");
    verify(mockConfiguration, times(1)).getInt("getint2", 0);
    verify(mockConfiguration, times(1)).getInteger("getint3", Integer.valueOf(0));
    verify(mockConfiguration, times(1)).getLong("getlong1");
    verify(mockConfiguration, times(1)).getLong("getlong2", 0L);
    verify(mockConfiguration, times(1)).getLong("getlong3", Long.valueOf(0L));
    verify(mockConfiguration, times(1)).getShort("getshort1");
    verify(mockConfiguration, times(1)).getShort("getshort2", (short) 0);
    verify(mockConfiguration, times(1)).getShort("getshort3", Short.valueOf((short) 0));
    verify(mockConfiguration, times(1)).getBigDecimal("getbigd1");
    verify(mockConfiguration, times(1)).getBigDecimal("getbigd2", BigDecimal.valueOf(0.4));
    verify(mockConfiguration, times(1)).getBigInteger("getbigi1");
    verify(mockConfiguration, times(1)).getBigInteger("getbigi2", BigInteger.valueOf(2L));
    verify(mockConfiguration, times(1)).getString("getstring1");
    verify(mockConfiguration, times(1)).getString("getstring2", "def");
    verify(mockConfiguration, times(1)).getStringArray("stringarray");
    verify(mockConfiguration, times(1)).getList("getlist1");
    verify(mockConfiguration, times(1)).getList("getlist2", Arrays.asList("a", "b"));
}

From source file:org.mobicents.servlet.restcomm.entities.shiro.Realm.java

private void loadSecurityRoles(final Configuration configuration) {
    @SuppressWarnings("unchecked")
    final List<String> roleNames = (List<String>) configuration.getList("role[@name]");
    final int numberOfRoles = roleNames.size();
    if (numberOfRoles > 0) {
        for (int roleIndex = 0; roleIndex < numberOfRoles; roleIndex++) {
            StringBuilder buffer = new StringBuilder();
            buffer.append("role(").append(roleIndex).append(")").toString();
            final String prefix = buffer.toString();
            final String name = configuration.getString(prefix + "[@name]");
            @SuppressWarnings("unchecked")
            final List<String> permissions = configuration.getList(prefix + ".permission");
            final int numberOfPermissions = permissions.size();
            if (name != null) {
                if (numberOfPermissions > 0) {
                    final SimpleRole role = new SimpleRole(name);
                    for (int permissionIndex = 0; permissionIndex < numberOfPermissions; permissionIndex++) {
                        String permissionName = permissions.get(permissionIndex);
                        //buffer = new StringBuilder();
                        //buffer.append(prefix).append(".permission(").append(permissionIndex).append(")");
                        final Permission permission = new WildcardPermission(permissionName);
                        role.add(permission);
                    }//  www .jav  a 2  s.  com
                    roles.put(name, role);
                }
            }
        }
    }
}

From source file:org.mobicents.servlet.restcomm.identity.shiro.RestcommRoles.java

private void loadSecurityRoles(final Configuration configuration) {
    @SuppressWarnings("unchecked")
    final List<String> roleNames = (List<String>) configuration.getList("role[@name]");
    final int numberOfRoles = roleNames.size();
    if (numberOfRoles > 0) {
        for (int roleIndex = 0; roleIndex < numberOfRoles; roleIndex++) {
            StringBuilder buffer = new StringBuilder();
            buffer.append("role(").append(roleIndex).append(")").toString();
            final String prefix = buffer.toString();
            final String name = configuration.getString(prefix + "[@name]");
            @SuppressWarnings("unchecked")
            final List<String> permissions = configuration.getList(prefix + ".permission");

            if (name != null) {
                if (permissions.size() > 0) {
                    final SimpleRole role = new SimpleRole(name);
                    for (String permissionString : permissions) {
                        //logger.info("loading permission " + permissionString + " into " + name + " role");
                        final Permission permission = new WildcardPermission(permissionString);
                        role.add(permission);
                    }/*from   w ww  .j av  a2  s . c  om*/
                    roles.put(name, role);
                }
            }
        }
    }
}

From source file:org.mobicents.servlet.restcomm.sms.smpp.SmppService.java

private void initializeSmppConnections() {
    Configuration smppConfiguration = this.configuration.subset("smpp");

    List<Object> smppConnections = smppConfiguration.getList("connections.connection.name");

    int smppConnecsSize = smppConnections.size();
    if (smppConnecsSize == 0) {
        logger.warning("No SMPP Connections defined!");
        return;/* ww w.  j  av a2  s. c  o  m*/
    }

    for (int count = 0; count < smppConnecsSize; count++) {
        String name = smppConfiguration.getString("connections.connection(" + count + ").name");
        String systemId = smppConfiguration.getString("connections.connection(" + count + ").systemid");
        String peerIp = smppConfiguration.getString("connections.connection(" + count + ").peerip");
        int peerPort = smppConfiguration.getInt("connections.connection(" + count + ").peerport");
        SmppBindType bindtype = SmppBindType
                .valueOf(smppConfiguration.getString("connections.connection(" + count + ").bindtype"));

        if (bindtype == null) {
            logger.warning("Bindtype for SMPP name=" + name + " is not specified. Using default TRANSCEIVER");
        }

        String password = smppConfiguration.getString("connections.connection(" + count + ").password");
        String systemType = smppConfiguration.getString("connections.connection(" + count + ").systemtype");

        byte interfaceVersion = smppConfiguration
                .getByte("connections.connection(" + count + ").interfaceversion");

        byte ton = smppConfiguration.getByte("connections.connection(" + count + ").ton");
        byte npi = smppConfiguration.getByte("connections.connection(" + count + ").npi");
        String range = smppConfiguration.getString("connections.connection(" + count + ").range");

        Address address = null;
        if (ton != -1 && npi != -1 && range != null) {
            address = new Address(ton, npi, range);
        }

        int windowSize = smppConfiguration.getInt("connections.connection(" + count + ").windowsize");

        long windowWaitTimeout = smppConfiguration
                .getLong("connections.connection(" + count + ").windowwaittimeout");

        long connectTimeout = smppConfiguration.getLong("connections.connection(" + count + ").connecttimeout");
        long requestExpiryTimeout = smppConfiguration
                .getLong("connections.connection(" + count + ").requestexpirytimeout");
        long windowMonitorInterval = smppConfiguration
                .getLong("connections.connection(" + count + ").windowmonitorinterval");
        boolean logBytes = smppConfiguration.getBoolean("connections.connection(" + count + ").logbytes");
        boolean countersEnabled = smppConfiguration
                .getBoolean("connections.connection(" + count + ").countersenabled");

        long enquireLinkDelay = smppConfiguration
                .getLong("connections.connection(" + count + ").enquirelinkdelay");

        Smpp smpp = new Smpp(name, systemId, peerIp, peerPort, bindtype, password, systemType, interfaceVersion,
                address, connectTimeout, windowSize, windowWaitTimeout, requestExpiryTimeout,
                windowMonitorInterval, countersEnabled, logBytes, enquireLinkDelay);

        this.smppList.add(smpp);

        if (logger.isInfoEnabled()) {
            logger.info("creating new SMPP connection " + smpp);
        }

    }

    // for monitoring thread use, it's preferable to create your own
    // instance of an executor and cast it to a ThreadPoolExecutor from
    // Executors.newCachedThreadPool() this permits exposing thinks like
    // executor.getActiveCount() via JMX possible no point renaming the
    // threads in a factory since underlying Netty framework does not easily
    // allow you to customize your thread names
    this.executor = (ThreadPoolExecutor) Executors.newCachedThreadPool();

    // to enable automatic expiration of requests, a second scheduled
    // executor is required which is what a monitor task will be executed
    // with - this is probably a thread pool that can be shared with between
    // all client bootstraps
    this.monitorExecutor = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(1,
            new ThreadFactory() {
                private AtomicInteger sequence = new AtomicInteger(0);

                @Override
                public Thread newThread(Runnable r) {
                    Thread t = new Thread(r);
                    t.setName("SmppServer-SessionWindowMonitorPool-" + sequence.getAndIncrement());
                    return t;
                }
            });

    // a single instance of a client bootstrap can technically be shared
    // between any sessions that are created (a session can go to any
    // different number of SMSCs) - each session created under a client
    // bootstrap will use the executor and monitorExecutor set in its
    // constructor - just be *very* careful with the "expectedSessions"
    // value to make sure it matches the actual number of total concurrent
    // open sessions you plan on handling - the underlying netty library
    // used for NIO sockets essentially uses this value as the max number of
    // threads it will ever use, despite the "max pool size", etc. set on
    // the executor passed in here

    // Setting expected session to be 25. May be this should be
    // configurable?
    this.clientBootstrap = new DefaultSmppClient(this.executor, 25, monitorExecutor);

    this.smppClientOpsThread = new SmppClientOpsThread(this.clientBootstrap, outboundInterface("udp").getPort(),
            smppMessageHandler);

    (new Thread(this.smppClientOpsThread)).start();

    for (Smpp smpp : this.smppList) {
        this.smppClientOpsThread.scheduleConnect(smpp);
    }

    if (logger.isInfoEnabled()) {
        logger.info("SMPP Service started");
    }
}