Beispiel #1
0
        private static UrlResolverDelegate CreateWindorUrlResolver(IWindsorContainer container)
        {
            IResourceSubSystem subSystem = (IResourceSubSystem)
                                           container.Kernel.GetSubSystem(SubSystemConstants.ResourceKey);

            return(delegate(string url, string basePath)
            {
                IResource resource;

                if (url.IndexOf(':') < 0)
                {
                    url = "file://" + url;
                }

                if (!string.IsNullOrEmpty(basePath))
                {
                    resource = subSystem.CreateResource(url, basePath);
                }
                else
                {
                    resource = subSystem.CreateResource(url);
                }
                using (resource)
                    using (TextReader reader = resource.GetStreamReader())
                        return new StringReader(reader.ReadToEnd());
            });
        }
        protected override AbstractConfigurationRunner InstallInto(IWindsorContainer container)
        {
            IResourceSubSystem system   = (IResourceSubSystem)container.Kernel.GetSubSystem(SubSystemConstants.ResourceKey);
            IResource          resource = system.CreateResource(uri);
            CustomUri          Uri      = new CustomUri(uri);

            return(BooReader.Read(container, Uri, GenerationOptions, GetName(), EnvironmentName));
        }
        public IResource GetResource(String resourceUri, IResource resource)
        {
            if (resourceUri.IndexOf(Uri.SchemeDelimiter) == -1)
            {
                return(resource.CreateRelative(resourceUri));
            }

            IResourceSubSystem subSystem = (IResourceSubSystem)
                                           Kernel.GetSubSystem(SubSystemConstants.ResourceKey);

            return(subSystem.CreateResource(resourceUri, resource.FileBasePath));
        }
Beispiel #4
0
        public static AbstractConfigurationRunner GetConfigurationInstanceFromResource(
            string name, string environment, IWindsorContainer container, CustomUri uri,
            GenerationOptions generationOptions, params string[] namespaces)
        {
            IResourceSubSystem system =
                (IResourceSubSystem)container.Kernel.GetSubSystem(SubSystemConstants.ResourceKey);
            IResource           resource      = system.CreateResource(uri);
            string              baseDirectory = Path.GetDirectoryName(uri.Path);
            UrlResolverDelegate urlResolver   = CreateWindorUrlResolver(container);

            return(GetConfigurationInstance(
                       name, environment, new ReaderInput(name, resource.GetStreamReader()),
                       generationOptions, new AutoReferenceFilesCompilerStep(baseDirectory, urlResolver),
                       namespaces));
        }
Beispiel #5
0
        public RhinoContainer(CustomUri uri, IEnvironmentInfo env)
            : base(new DefaultKernel(), CreateInterpreter(uri, env))
        {
            IResourceSubSystem system   = (IResourceSubSystem)Kernel.GetSubSystem(SubSystemConstants.ResourceKey);
            IResource          resource = system.CreateResource(uri);

            if (IsBoo(uri))
            {
                RunInstaller();
            }
            else
            {
                InitalizeFromConfigurationSource(
                    new XmlInterpreter(resource), env);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultXmlProcessorEngine"/> class.
 /// </summary>
 /// <param name="environmentName">Name of the environment.</param>
 /// <param name="resourceSubSystem">The resource sub system.</param>
 public DefaultXmlProcessorEngine(string environmentName, IResourceSubSystem resourceSubSystem)
 {
     AddEnvNameAsFlag(environmentName);
     this.resourceSubSystem  = resourceSubSystem;
     defaultElementProcessor = new DefaultElementProcessor();
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="DefaultXmlProcessorEngine"/> class.
		/// </summary>
		/// <param name="environmentName">Name of the environment.</param>
		/// <param name="resourceSubSystem">The resource sub system.</param>
		public DefaultXmlProcessorEngine(string environmentName, IResourceSubSystem resourceSubSystem)
		{
			AddEnvNameAsFlag(environmentName);
			this.resourceSubSystem = resourceSubSystem;
			defaultElementProcessor = new DefaultElementProcessor();
		}
Beispiel #8
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "XmlProcessor" /> class.
 /// </summary>
 /// <param name = "environmentName">Name of the environment.</param>
 /// <param name = "resourceSubSystem">The resource sub system.</param>
 public XmlProcessor(string environmentName, IResourceSubSystem resourceSubSystem)
 {
     engine = new DefaultXmlProcessorEngine(environmentName, resourceSubSystem);
     RegisterProcessors();
 }
 /// <summary>
 ///   Constructor
 /// </summary>
 /// <param name="environmentName">Environment name</param>
 /// <param name="resourceSubSystem">Resource subsystem</param>
 public PropertiesXmlProcessor(string environmentName, IResourceSubSystem resourceSubSystem)
 {
     m_engine = new DefaultXmlProcessorEngine(environmentName, resourceSubSystem);
       RegisterProcessors();
 }