public void Initialize(IConfigSource config) 
        {
            IConfig serverConfig = config.Configs["CableBeachService"];
            if (serverConfig == null)
                throw new Exception("No WebDAV section in config file");
                
            if(!serverConfig.Contains("ConnectionString"))
                throw new Exception("No ConnectionString specified in WebDAV section in config file");

            connectionString = serverConfig.GetString("ConnectionString");

            storageModule = new NHibernateIWebDAVResource();
            storageModule.Initialise(connectionString);
        }
Ejemplo n.º 2
0
        public bool Start(System.Net.IPAddress ip, int port)
        {
            try
            {
                m_listener = HttpListener.Create(httpserverlog, ip, port);
                m_webdav = new WebDAVListener(m_listener, @"^/inventory/");
                m_webdav.Authentication = AuthenticationType.None;
                m_listener.Start(10);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[WORLDINVENTORY]: Failed to start WebDAV listener on port {0}. Threw excpetion {1}", port, e.ToString());
                return false;
            }

            string webdavPropertyStrgConnectionString = String.Empty;
            IConfig config = m_configs.Configs["realXtend"];
            if (config != null)
            {
                webdavPropertyStrgConnectionString = config.GetString("WebDAVProperyStorageConnectionString");
                m_giveFolderContentOnGet = config.GetBoolean("WorldInventoryGetFolderContent", false);
                m_autoconvertJpgToJ2k = config.GetBoolean("WorldInventoryAutoConvertJpegToJ2K", false);
            }

            if (webdavPropertyStrgConnectionString == null || webdavPropertyStrgConnectionString == String.Empty)
                return false;

            m_assetFolderStrg = new NHibernateAssetsFolder();
            m_propertyMngr = new NHibernateIWebDAVResource();
            m_propertyMngr.Initialise(webdavPropertyStrgConnectionString);
            m_assetFolderStrg.Initialise(webdavPropertyStrgConnectionString);
            AddRootFolders();

            m_webdav.OnPropFind += PropFindHandler;
            m_webdav.OnGet += GetHandler;
            m_webdav.OnPut += PutHandler;
            m_webdav.OnNewCol += MkcolHandler;
            m_webdav.OnMove += MoveHandler;
            m_webdav.OnDelete += DeleteHandler;

            return true;
        }