Source

Camino / src / Empi.Camino / Web / IFileResource.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Empi.Camino.Web.Data;
using Microsoft.Practices.Unity;

namespace Empi.Camino
{

    internal class DIContainer
    { 
        private IUnityContainer _DIContainer = new UnityContainer();

        private DIContainer()
        {
            Initialize();
        }


        internal static DIContainer GetDIContainer()
        {
            return DataStoreFactory.GetApplicationDataStore.LazyGet<DIContainer>("DIContainer", () => new DIContainer());
        }

        private void Initialize()
        { 
            //MP: mache eine tabelle {Baseclass, Class, Name}
            //MP: initialize from DataBase
            

        
        
        
        }

        public T Resolve<T>(string name)
        {
            return _DIContainer.Resolve<T>(name);
        }
    
    }


}

namespace Empi.Camino.Web
{
    interface IFileResource
    {
        string AbsoluteUrl
        { get; }

        string Id
        { get; }
    }

    internal class FileResource : IFileResource
    {
        internal FileResource(IFileResourceProvider fileResourceProvider)
        {
            _fileResourceProvider = fileResourceProvider;
        }

        private IFileResourceProvider _fileResourceProvider;


        #region IFileResource Members

        public string AbsoluteUrl
        {
            get { throw new NotImplementedException(); }
        }

        public string Id
        {
            get { throw new NotImplementedException(); }
        }

        #endregion
    }
    
    interface IFileResourceProvider
    {
        string GetAbsoluteUrl(string id);
    }

    //internal class S3ResourceProvider : IFileResourceProvider
    //{ 
    
    
    //}

    internal class LocalResourceProvider : IFileResourceProvider
    {


        #region IFileResourceProvider Members

        public string GetAbsoluteUrl(string id)
        {
            throw new NotImplementedException();
        }

        #endregion
    }



    internal class FileResourceFactory
    {

        private FileResourceFactory()
        { }

        internal static FileResourceFactory GetFileResourceFactory()
        {
            return new FileResourceFactory();
        }


        
        //MP: {FileRessourceId,FileRessourceProviderName}
        


        private IFileResourceProvider GetFileRessourceProvider(string providerName)
        {
            return DIContainer.GetDIContainer().Resolve<IFileResourceProvider>(providerName);
        }


        internal IFileResource GetFileRessource(string id)
        {
            return null;
        }

        internal IFileResource SaveFileRessource(string id, Stream fileStream)
        {
            return null;
        }





    

    
    }

}