Esempio n. 1
0
 /// <summary>
 /// Initialize the template loader with a
 /// a resources class.
 /// </summary>
 public override void Init(ExtendedProperties configuration)
 {
     assemblyNames = configuration.GetVector("assembly");
     prefixes      = configuration.GetVector("prefix");
     if (assemblyNames.Count != prefixes.Count)
     {
         throw new ResourceNotFoundException("Need to specify prefixes!");
     }
 }
Esempio n. 2
0
        public override void init(ExtendedProperties configuration)
        {
            rsvc.info("FileResourceLoader : initialization starting.");

            paths = configuration.GetVector("path");

            // lets tell people what paths we will be using
            foreach (String path in paths)
            {
                rsvc.info("FileResourceLoader : adding path '" + path + "'");
            }

            rsvc.info("FileResourceLoader : initialization complete.");
        }
        /// <seealso cref="org.apache.velocity.runtime.resource.loader.ResourceLoader.Init(org.apache.commons.collections.ExtendedProperties)">
        /// </seealso>
        public override void Init(ExtendedProperties configuration)
        {
            if (log.TraceEnabled)
            {
                log.Trace("FileResourceLoader : initialization starting.");
            }

            ArrayList vectors = configuration.GetVector("path");

            foreach (var o in vectors)
            {
                paths.Add(o.ToString());
            }

            // unicode files may have a BOM marker at the start, but Java
            // has problems recognizing the UTF-8 bom. Enabling unicode will
            // recognize all unicode boms.
            unicode = configuration.GetBoolean("unicode", false);

            if (log.DebugEnabled)
            {
                log.Debug("Do unicode file recognition:  " + unicode);
            }

            if (log.DebugEnabled)
            {
                // trim spaces from all paths
                StringUtils.TrimStrings(paths);

                // this section lets tell people what paths we will be using
                int sz = paths.Count;
                for (int i = 0; i < sz; i++)
                {
                    log.Debug("FileResourceLoader : adding path '" + ((string)paths[i]) + "'");
                }
                log.Trace("FileResourceLoader : initialization complete.");
            }
        }
 /// <summary>
 /// Initialize the template loader with a
 /// a resources class.
 /// </summary>
 public override void init(ExtendedProperties configuration)
 {
     assemblyNames = configuration.GetVector("assembly");
 }
Esempio n. 5
0
        public override void Init(ExtendedProperties configuration)
        {
            runtimeServices.Info("FileResourceLoader : initialization starting.");

            paths = configuration.GetVector("path");
        }
Esempio n. 6
0
 public override void Init(ExtendedProperties configuration)
 {
     this.rsvc.Info("FileResourceLoader : initialization starting.");
     this.paths = configuration.GetVector("path");
 }
 public override void Init(ExtendedProperties configuration)
 {
     paths = configuration.GetVector("path");
 }
Esempio n. 8
0
        public virtual void  Test_run()
        {
            System.IO.StreamWriter result = null;
            ExtendedProperties     c      = null;

            try {
                assureResultsDirectoryExists(RESULTS_DIR);
                c      = new ExtendedProperties(TEST_CONFIG);
                result = new System.IO.StreamWriter(getFileName(RESULTS_DIR, "output", "res"));
            } catch (System.Exception e) {
                throw new System.Exception("Cannot setup CommonsExtPropTestCase!", e);
            }

            message(result, "Testing order of keys ...");
            showIterator(result, c.Keys);

            message(result, "Testing retrieval of CSV values ...");
            showVector(result, c.GetVector("resource.loader"));

            message(result, "Testing subset(prefix).getKeys() ...");
            ExtendedProperties subset = c.Subset("file.resource.loader");

            showIterator(result, subset.Keys);

            message(result, "Testing getVector(prefix) ...");
            showVector(result, subset.GetVector("path"));

            message(result, "Testing getString(key) ...");
            result.Write(c.GetString("config.string.value"));
            result.Write("\n\n");

            message(result, "Testing getBoolean(key) ...");
            //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Boolean.toString' may return a different value. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1043"'
            result.Write(c.GetBoolean("config.boolean.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getByte(key) ...");
            result.Write(c.GetByte("config.byte.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getShort(key) ...");
            result.Write(c.GetShort("config.short.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getInt(key) ...");
            result.Write(c.GetInt("config.int.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getLong(key) ...");
            result.Write(c.GetLong("config.long.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getFloat(key) ...");
            result.Write(c.GetFloat("config.float.value").ToString());
            result.Write("\n\n");

            message(result, "Testing getDouble(key) ...");
            result.Write(c.GetDouble("config.double.value").ToString());
            result.Write("\n\n");

            message(result, "Testing escaped-comma scalar...");
            result.Write(c.GetString("escape.comma1"));
            result.Write("\n\n");

            message(result, "Testing escaped-comma vector...");
            showVector(result, c.GetVector("escape.comma2"));
            result.Write("\n\n");

            result.Flush();
            result.Close();

            if (!isMatch(RESULTS_DIR, COMPARE_DIR, "output", "res", "cmp"))
            {
                Assertion.Fail("Output incorrect.");
            }
        }