Package org.apache.commons.collections

Examples of org.apache.commons.collections.ExtendedProperties


         *  Yuk. We added a little helper to Configuration to
         *  help with deprecation.  The Configuration class
         *  contains a 'shadow' ExtendedProperties
         */

        ExtendedProperties ep = configuration.getExtendedProperties();

        RuntimeSingleton.setConfiguration( ep );
    }
View Full Code Here


     */
    public void setProperty(String key, Object value)
    {
        if (overridingProperties == null)
        {
            overridingProperties = new ExtendedProperties();
        }           
           
        overridingProperties.setProperty( key, value );
    }       
View Full Code Here

     */
    public void addProperty(String key, Object value)
    {
        if (overridingProperties == null)
        {
            overridingProperties = new ExtendedProperties();
        }           
           
        overridingProperties.addProperty( key, value );
    }
View Full Code Here

     * @param Properties
     */
    public void init(String configurationFile)
        throws Exception
    {
        overridingProperties = new ExtendedProperties(configurationFile);
        init();
    }
View Full Code Here

       
        assembleResourceLoaderInitializers();
       
        for (int i = 0; i < sourceInitializerList.size(); i++)
        {
            ExtendedProperties configuration = (ExtendedProperties) sourceInitializerList.get(i);
            String loaderClass = configuration.getString("class");

            if ( loaderClass == null)
            {
                rsvc.error"Unable to find '"
                                + configuration.getString(RESOURCE_LOADER_IDENTIFIER)
                                + ".resource.loader.class' specification in configuation."
                                + " This is a critical value.  Please adjust configuration.");
                continue;
            }
View Full Code Here

             * pertaining to a particular loader.
             */
            String loaderID =
                resourceLoaderNames.get(i) + "." + RuntimeConstants.RESOURCE_LOADER;

            ExtendedProperties loaderConfiguration =
                rsvc.getConfiguration().subset(loaderID);

            /*
             *  we can't really count on ExtendedProperties to give us an empty set
             */

            if ( loaderConfiguration == null)
            {
                rsvc.warn("ResourceManager : No configuration information for resource loader named '"
                          + resourceLoaderNames.get(i) + "'. Skipping.");
                continue;
            }

            /*
             *  add the loader name token to the initializer if we need it
             *  for reference later. We can't count on the user to fill
             *  in the 'name' field
             */

            loaderConfiguration.setProperty( RESOURCE_LOADER_IDENTIFIER, resourceLoaderNames.get(i));

            /*
             * Add resources to the list of resource loader
             * initializers.
             */
 
View Full Code Here

     */
    protected void processContextProperties( String file )
        throws Exception
    {
        String[] sources = StringUtils.split(file,",");
        contextProperties = new ExtendedProperties();
       
        // Always try to get the context properties resource
        // from a file first. Templates may be taken from a JAR
        // file but the context properties resource may be a
        // resource in the filesystem. If this fails than attempt
        // to get the context properties resource from the
        // classpath.
        for (int i = 0; i < sources.length; i++)
        {
            ExtendedProperties source = new ExtendedProperties();
            try
            {
                // resolve relative path from basedir and leave
                // absolute path untouched.
                File fullPath = resolveFile(sources[i]);
                log("Using contextProperties file: " + fullPath);
                source.load(new FileInputStream(fullPath));
            }
            catch (Exception e)
            {
                ClassLoader classLoader = this.getClass().getClassLoader();
           
                try
                {
                    InputStream inputStream = classLoader.getResourceAsStream(sources[i]);
               
                    if (inputStream == null)
                    {
                        throw new Exception("Context properties file " + sources[i] +
                            " could not be found in the file system or on the classpath!");
                    }
                    else
                    {
                        source.load(inputStream);
                    }
                }
                catch (IOException ioe)
                {
                    source = null;
                }
            }
       
            Iterator j = source.getKeys();
           
            while (j.hasNext())
            {
                String name = (String) j.next();
                String value = source.getString(name);
                contextProperties.setProperty(name,value);
            }
        }
    }
View Full Code Here

     * generating process starts.
     */
    public void setContextProperties( String file )
    {
        String[] sources = StringUtils.split(file,",");
        contextProperties = new ExtendedProperties();
       
        // Always try to get the context properties resource
        // from a file first. Templates may be taken from a JAR
        // file but the context properties resource may be a
        // resource in the filesystem. If this fails than attempt
        // to get the context properties resource from the
        // classpath.
        for (int i = 0; i < sources.length; i++)
        {
            ExtendedProperties source = new ExtendedProperties();
           
            try
            {
                // resolve relative path from basedir and leave
                // absolute path untouched.
                File fullPath = project.resolveFile(sources[i]);
                log("Using contextProperties file: " + fullPath);
                source.load(new FileInputStream(fullPath));
            }
            catch (Exception e)
            {
                ClassLoader classLoader = this.getClass().getClassLoader();
           
                try
                {
                    InputStream inputStream = classLoader.getResourceAsStream(sources[i]);
               
                    if (inputStream == null)
                    {
                        throw new BuildException("Context properties file " + sources[i] +
                            " could not be found in the file system or on the classpath!");
                    }
                    else
                    {
                        source.load(inputStream);
                    }
                }
                catch (IOException ioe)
                {
                    source = null;
                }
            }
       
            Iterator j = source.getKeys();
           
            while (j.hasNext())
            {
                String name = (String) j.next();
                String value = source.getString(name);
                contextProperties.setProperty(name,value);
            }
        }
    }
View Full Code Here

        try
        {
            if ( velocityPropertiesFile.exists() )
            {
                String file = velocityPropertiesFile.getAbsolutePath();
                ExtendedProperties config = new ExtendedProperties(file);
                ve.setExtendedProperties(config);
            }

            // override the templatePath if it exists
            if (templatePath != null && templatePath.length() > 0)
View Full Code Here

        {
            /**
             * Resource loader can be loaded either via class name or be passed
             * in as an instance.
             */
            ExtendedProperties configuration = (ExtendedProperties) it.next();

            String loaderClass = StringUtils.nullTrim(configuration.getString("class"));
            ResourceLoader loaderInstance = (ResourceLoader) configuration.get("instance");

            if (loaderInstance != null)
            {
                resourceLoader = loaderInstance;
            }
            else if (loaderClass != null)
            {
                resourceLoader = ResourceLoaderFactory.getLoader(rsvc, loaderClass);
            }
            else
            {
                log.error("Unable to find '" +
                          configuration.getString(RESOURCE_LOADER_IDENTIFIER) +
                          ".resource.loader.class' specification in configuation." +
                          " This is a critical value.  Please adjust configuration.");

                continue; // for(...
            }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.ExtendedProperties

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.