Package org.apache.stratum.configuration

Examples of org.apache.stratum.configuration.Configuration


    }

    public void testConstructor()
    {
        ComponentLoader loader = new ComponentLoader(config);
        Configuration loaderConfig = loader.getConfiguration();
        assertNotNull(loaderConfig);
        assertEquals("org.apache.stratum.component.MockComponent",
                     loaderConfig.getString("component.testing.classname"));
    }
View Full Code Here


     */
    public void init()
        throws InitializationException
    {
        String path = null;
        Configuration conf = getConfiguration();
        if (conf != null)
        {
            path = conf.getString(MIME_TYPES);
            if (path != null)
            {
                path = TurbineServlet.getRealPath(path);
            }
        }
        if (path != null)
        {
            try
            {
                mimeTypeMap = new MimeTypeMap(path);
            }
            catch (IOException x)
            {
                throw new InitializationException(path,x);
            }
        }
        else
        {
            mimeTypeMap = new MimeTypeMap();
        }

        if (conf != null)
        {
            path = conf.getString(CHARSETS);
            if (path != null)
            {
                path = TurbineServlet.getRealPath(path);
            }
        }
View Full Code Here

    private void initTemplate()
    {
        /*
         * Get the configuration for the template service.
         */
        Configuration config = getConfiguration();

        /*
         * Get the default extension to use if nothing else is applicable.
         */
        defaultExtension = config.getString("default.extension",NO_FILE_EXT);
        defaultTemplate = "Default." + defaultExtension;

        /*
         * Check to see if we are going to be caching modules.
         */
        useCache = TurbineResources.getBoolean("module.cache",true);

        if (useCache)
        {
            int screenSize = config.getInt("screen.cache.size",5);
            int screenTemplateSize = config.getInt("screen.cache.size",50);
            int layoutSize = config.getInt("layout.cache.size",5);
            int layoutTemplateSize = config.getInt("layout.cache.size",5);
            int navigationSize = config.getInt("navigation.cache.size",10);

            /*
             * Create hashtables for each object type,
             * the first one for pages is not used.
             */
 
View Full Code Here

     * @param defaultExt The default used when the default defined in the
     *                   properties file is missing or misconfigured.
     */
    protected void initConfiguration(String defaultExt)
    {
        Configuration config = getConfiguration();

        /*
         * Should modify the configuration class to take defaults
         * here, should have to do this.
         */
        String[] fileExtensionAssociations =
            config.getStringArray(TEMPLATE_EXTENSIONS);

        if (fileExtensionAssociations == null ||
            fileExtensionAssociations.length == 0)
        {
            fileExtensionAssociations = new String[1];
            fileExtensionAssociations[0] = config.getString(
                DEFAULT_TEMPLATE_EXTENSION, defaultExt);
        }

        configuration.put(TEMPLATE_EXTENSIONS, fileExtensionAssociations);

        /*
         * We need some better error checking here and should probably
         * throw an exception here if these things aren't set
         * up correctly.
         */
        configuration.put(DEFAULT_PAGE, config.getString(DEFAULT_PAGE));
        configuration.put(DEFAULT_SCREEN, config.getString(DEFAULT_SCREEN));
        configuration.put(DEFAULT_LAYOUT, config.getString(DEFAULT_LAYOUT));
        configuration.put(DEFAULT_NAVIGATION,
                          config.getString(DEFAULT_NAVIGATION));
        configuration.put(DEFAULT_ERROR_SCREEN,
                          config.getString(DEFAULT_ERROR_SCREEN));
        configuration.put(DEFAULT_LAYOUT_TEMPLATE,
                          config.getString(DEFAULT_LAYOUT_TEMPLATE));
    }
View Full Code Here

     * @throws InitializationException if initialization fails.
     */
    public void init()
        throws InitializationException
    {
        Configuration conf = getConfiguration();
        if (conf != null)
        {
            try
            {
                int capacity = conf.getInt(POOL_CAPACITY,DEFAULT_POOL_CAPACITY);
                if (capacity <= 0)
                {
                    throw new IllegalArgumentException("Capacity must be >0");
                }
                poolCapacity = capacity;
View Full Code Here

        PoolBuffer pool = (PoolBuffer) poolRepository.get(className);
        if (pool == null)
        {
            /* Check class specific capacity. */
            int capacity = poolCapacity;
            Configuration conf = getConfiguration();
            if (conf != null)
            {
                try
                {
                    capacity = conf.getInt(
                        POOL_CAPACITY + '.' + className,poolCapacity);
                    if (capacity <= 0)
                    {
                        capacity = poolCapacity;
                    }
View Full Code Here

     * @exception InitializationException Thrown by Turbine.
     */
    private void initWebMacro()
        throws InitException, InitializationException
    {
        Configuration config = getConfiguration();

        /*
         * We retrieve the template paths here and translate
         * them so that we have a functional templateExists(name)
         * method in this service. This happens again in
         * the provider so that we don't have to store the
         * converted configuration, and we don't want to
         * store them because the initialization of this
         * service is done in one pass. This means that
         * the provider trying to retrieve the converted
         * properties via this service we get a recursion
         * problem. What would be idea is if the service
         * broker could store the properties for each of
         * the services, even if they are converted. Just
         * trying to explain what's going on.
         */
        templatePaths = config.getStringArray("templates");
        templatePaths = TurbineTemplate.translateTemplatePaths(templatePaths);

        WMTemplateProvider = config.getString("templates.provider", null);
        WMProperties = config.getString("properties");

        if (WMProperties != null)
        {
            /*
             * If possible, transform paths to be webapp
View Full Code Here

     * @param config A ServletConfig.
     * @exception Exception, a generic exception.
     */
    private void initFreeMarker() throws Exception
    {
        Configuration config = getConfiguration();

        path = config.getString("templates", "/templates");

        // If possible, transform paths to be webapp root relative.
        path = TurbineServlet.getRealPath(path);

        // Store the converted path in service properties for Turbine
        // based providers.
        config.setProperty("templates", path);

        templateCache = new FileTemplateCache(path);
        templateCache.addCacheListener(this);
        templateCache.startAutoUpdate();
    }
View Full Code Here

            /*
             * We are specifically not getting the configuration
             * from the service because it hasn't finished
             * init'ing we're getting it from the service broker.
             */
            Configuration config = TurbineServices.getInstance()
                .getConfiguration(WebMacroService.SERVICE_NAME);

            paths = config.getStringArray("templates");
            paths = TurbineTemplate.translateTemplatePaths(paths);

            StringBuffer pathMsg = new StringBuffer("TurbineTemplateProvider path(s):");

            for (int i = 0; i < paths.length; i++)
View Full Code Here

                    // Get the values for the JSSE system properties
                    // that we must set for use in the SecureWebServer
                    // and the URL https connection handler that is
                    // used in XmlRpcClient.

                    Configuration secureServerOptions =
                        getConfiguration().subset("secure.server.option");

                    Iterator i = secureServerOptions.getKeys();

                    while (i.hasNext())
                    {
                        String option = (String) i.next();
                        String value = secureServerOptions.getString(option);

                        Log.debug("JSSE option: " + option + " => " + value);

                        System.setProperty(option, value);
                    }
View Full Code Here

TOP

Related Classes of org.apache.stratum.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.