Exemple #1
0
        /// <summary>
        /// This will produce a List of Hashtables, each
        /// hashtable contains the initialization info for
        /// a particular resource loader. This Hashtable
        /// will be passed in when initializing the
        /// the template loader.
        /// </summary>
        private void AssembleResourceLoaderInitializers()
        {
            if (resourceLoaderInitializersActive)
            {
                return;
            }

            ArrayList resourceLoaderNames = runtimeServices.Configuration.GetVector(RuntimeConstants.RESOURCE_LOADER);

            for (int i = 0; i < resourceLoaderNames.Count; i++)
            {
                /*
                 * The loader id might look something like the following:
                 *
                 * file.resource.loader
                 *
                 * The loader id is the prefix used for all properties
                 * pertaining to a particular loader.
                 */
                String loaderID = string.Format("{0}.{1}", resourceLoaderNames[i], RuntimeConstants.RESOURCE_LOADER);

                ExtendedProperties loaderConfiguration = runtimeServices.Configuration.Subset(loaderID);

                /*
                 *  we can't really count on ExtendedProperties to give us an empty set
                 */
                if (loaderConfiguration == null)
                {
                    runtimeServices.Warn(
                        string.Format("ResourceManager : No configuration information for resource loader named '{0}'. Skipping.",
                                      resourceLoaderNames[i]));
                    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[i]);

                /*
                 * Add resources to the list of resource loader
                 * initializers.
                 */
                sourceInitializerList.Add(loaderConfiguration);
            }

            resourceLoaderInitializersActive = true;
        }