Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.Configuration


     * @exception NamingException could not create InitialContext
     */
    public void doPerform(RunData data)
            throws NamingException
    {
        Configuration conf = Turbine.getConfiguration();

        // Context properties are specified in lines in the properties
        // file that begin with "context.contextname.", allowing
        // multiple named contexts to be used.  Everything after the
        // "contextname." is the name of the property that will be
        // used by the InitialContext class to create a new context
        // instance.

        Hashtable contextPropsList = new Hashtable();
        for (Iterator contextKeys = conf.getKeys("context.");
                contextKeys.hasNext();)
        {
            String key = (String) contextKeys.next();
            int start = key.indexOf(".") + 1;
            int end = key.indexOf(".", start);
            String contextName = key.substring(start, end);
            Properties contextProps = null;
            if (contextPropsList.containsKey(contextName))
            {
                contextProps = (Properties) contextPropsList.get(contextName);
            }
            else
            {
                contextProps = new Properties();
            }
            contextProps.put(key.substring(end + 1),
                             conf.getString(key));
            contextPropsList.put(contextName, contextProps);
        }
        for (Iterator contextPropsKeys = contextPropsList.keySet().iterator();
                contextPropsKeys.hasNext();)
        {
View Full Code Here


        super(testName);

        // Setup configuration
        ServiceManager serviceManager = TurbineServices.getInstance();
        serviceManager.setApplicationRoot(".");
        Configuration cfg = new BaseConfiguration();
        cfg.setProperty(ParserUtils.URL_CASE_FOLDING_KEY,
                ParserUtils.URL_CASE_FOLDING_LOWER_VALUE );
        serviceManager.setConfiguration(cfg);

    }
View Full Code Here

        throws Exception
    {
        ServiceManager serviceManager = TurbineServices.getInstance();
        serviceManager.setApplicationRoot(".");

        Configuration cfg = new BaseConfiguration();

        cfg.setProperty(PREFIX + "classname",
                        DBSecurityService.class.getName());

        cfg.setProperty(PREFIX + "acl.class",
                        TurbineAccessControlList.class.getName());

        // We must run init!
        cfg.setProperty(PREFIX+"earlyInit", "true");

        /* Ugh */

        cfg.setProperty("services." + FactoryService.SERVICE_NAME + ".classname",
                        TurbineFactoryService.class.getName());

        serviceManager.setConfiguration(cfg);

        serviceManager.init();
View Full Code Here

     * Called the first time the Service is used.
     */
    public void init()
            throws InitializationException
    {
        Configuration conf = Turbine.getConfiguration();

        initBundleNames(null);

        Locale jvmDefault = Locale.getDefault();

        defaultLanguage = conf.getString("locale.default.language",
                jvmDefault.getLanguage()).trim();
        defaultCountry = conf.getString("locale.default.country",
                jvmDefault.getCountry()).trim();

        defaultLocale = new Locale(defaultLanguage, defaultCountry);
        setInit(true);
    }
View Full Code Here

     *
     * @param ignored Ignored.
     */
    protected void initBundleNames(String[] ignored)
    {
        Configuration conf = Turbine.getConfiguration();
        bundleNames = conf.getStringArray("locale.default.bundles");
        String name = conf.getString("locale.default.bundle");

        if (name != null && name.length() > 0)
        {
            // Using old-style single bundle name property.
            if (bundleNames == null || bundleNames.length <= 0)
View Full Code Here

    }

    public void testPathTranslation()
        throws Exception
    {
        Configuration conf = vs.getConfiguration();
        ExtendedProperties ep = ((TurbineVelocityService) vs).createVelocityProperties(conf);

        String rootPath = Turbine.getRealPath("");

        String [] test1 = ep.getStringArray("test1.resource.loader.path");
View Full Code Here

     */
    public static int getUrlFolding()
    {
        if (folding == URL_CASE_FOLDING_UNSET)
        {
            Configuration conf = TurbineServices.getInstance().getConfiguration();
            String foldString = conf.getString(URL_CASE_FOLDING_KEY,
                                               URL_CASE_FOLDING_NONE_VALUE).toLowerCase();

            folding = URL_CASE_FOLDING_NONE;

            log.debug("Setting folding from " + foldString);
View Full Code Here

        super(name);

        ServiceManager serviceManager = TurbineServices.getInstance();
        serviceManager.setApplicationRoot(".");

        Configuration cfg = new BaseConfiguration();
        cfg.setProperty(PREFIX + "classname", TurbineNonPersistentSchedulerService.class.getName());

        cfg.setProperty(PREFIX + "scheduler.jobs", "SimpleJob");
        cfg.setProperty(PREFIX + "scheduler.job.SimpleJob.ID", "1");
        cfg.setProperty(PREFIX + "scheduler.job.SimpleJob.SECOND", "10");
        cfg.setProperty(PREFIX + "scheduler.job.SimpleJob.MINUTE", "-1");
        cfg.setProperty(PREFIX + "scheduler.job.SimpleJob.HOUR", "-1");
        cfg.setProperty(PREFIX + "scheduler.job.SimpleJob.WEEK_DAY", "-1");
        cfg.setProperty(PREFIX + "scheduler.job.SimpleJob.DAY_OF_MONTH", "-1");
        cfg.setProperty(PREFIX + "enabled", "true");

        serviceManager.setConfiguration(cfg);

        try
        {
View Full Code Here

     * @param languageHeader A String with the language header.
     * @return A Locale.
     */
    public static Locale getLocale(String languageHeader)
    {
        Configuration conf = Turbine.getConfiguration();


        // return a "default" locale
        if (languageHeader == null ||
                languageHeader.trim().equals(""))
        {
            return new Locale(
                    conf.getString("locale.default.language", "en"),
                    conf.getString("locale.default.country", "US"));
        }

        // The HTTP Accept-Header is something like
        //
        // "en, es;q=0.8, zh-TW;q=0.1"
View Full Code Here

            DEFAULT_COOKIE_PARSER
        };
        configurations.put(DEFAULT_CONFIG, def.clone());

        // Check other configurations.
        Configuration conf = getConfiguration();
        if (conf != null)
        {
            String key,value;
            String[] config;
            String[] plist = new String[]
            {
                RUN_DATA_KEY,
                PARAMETER_PARSER_KEY,
                COOKIE_PARSER_KEY
            };
            for (Iterator i = conf.getKeys(); i.hasNext();)
            {
                key = (String) i.next();
                value = conf.getString(key);
                for (int j = 0; j < plist.length; j++)
                {
                    if (key.endsWith(plist[j]) &&
                            (key.length() > (plist[j].length() + 1)))
                    {
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.