示例#1
0
		public virtual void setLocations(IList<string> fileNames)
		{

			IList<Resource> resources = new List<Resource>();
			foreach (string filename in fileNames)
			{

				// trim
				filename = filename.Trim();

				string realFileName = getFileName(filename);

				//
				// register to disconf
				//
				DisconfMgr.Instance.reloadableScan(realFileName);

				//
				// only properties will reload
				//
				string ext = FilenameUtils.getExtension(filename);
				if (ext.Equals("properties"))
				{

					PathMatchingResourcePatternResolver pathMatchingResourcePatternResolver = new PathMatchingResourcePatternResolver();
					try
					{
						Resource[] resourceList = pathMatchingResourcePatternResolver.getResources(filename);
						foreach (Resource resource in resourceList)
						{
							resources.Add(resource);
						}
					}
					catch (IOException e)
					{
						Console.WriteLine(e.ToString());
						Console.Write(e.StackTrace);
					}
				}
			}

			this.locations = resources.ToArray();
			lastModified = new long[locations.Length];
			base.Locations = locations;
		}
示例#2
0
        private IList <string> readFolderContent(string folder)
        {
            IList <string> files = new List <string>();
            string         path  = "classpath:" + folder + "/*";

            try
            {
                PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
                Resource[] resources = resolver.getResources(path);
                assertThat("No resources found at " + path, resources.Length, greaterThan(0));
                foreach (Resource res in resources)
                {
                    files.Add(res.Filename);
                }
            }
            catch (IOException)
            {
                fail("unable to load resources from " + path);
            }

            return(files);
        }