Esempio n. 1
0
        /// <summary>
        /// Opens the read.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element)
        {
            FileStorageAutoCommitedTransactedStream result = null;

            if (element != null && !(element is CollectionInfo))
            {
                DummyFileInfoWrapper fileInfo = element.Tag as DummyFileInfoWrapper;
                if (fileInfo != null)
                {
                    CheckRight(fileInfo, "Read");

                    //update download counter
                    Mediachase.IBN.Database.ControlSystem.DBFile.FileBinaryModifyCounter(fileInfo.FileBinaryId);
                    try
                    {
                        result             = new FileStorageAutoCommitedTransactedStream(DataContext.Current.BeginTransaction(), 0);
                        result.InnerStream = Mediachase.IBN.Database.ControlSystem.DBFile.OpenRead(fileInfo.FileBinaryId);
                    }
                    catch (Exception)
                    {
                        throw new HttpException(404, "Not Found");
                    }
                }
            }

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// Opens the write.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength)
        {
            FileStorageAutoCommitedTransactedStream result = null;

            if (element != null && !(element is CollectionInfo))
            {
                DummyFileInfoWrapper fileInfo = element.Tag as DummyFileInfoWrapper;
                if (fileInfo != null)
                {
                    CheckRight(fileInfo, "Write");

                    try
                    {
                        //Auto committed transaction stream wrapper
                        result = new FileStorageAutoCommitedTransactedStream(DataContext.Current.BeginTransaction(), fileInfo.ContainerKey,
                                                                             fileInfo.ParrentDirectoryId, fileInfo.Name, contentLength);
                        result.InnerStream = new MemoryStream();
                    }
                    catch (Exception)
                    {
                        throw new HttpException(404, "Not Found");
                    }
                }
            }

            return(result);
        }
Esempio n. 3
0
        public override Mediachase.Net.Wdom.PropertyInfoCollection GetProperties(Mediachase.Net.Wdom.WebDavElementInfo element)
        {
            PropertyInfoCollection retVal = new PropertyInfoCollection();
            PropertyInfo           prop   = null;

            #region CreateDefaultProperties
            foreach (PropertyInfo defaultProp in PropertyInfo.CreateDefaultProperties(element))
            {
                SetProperty(retVal, defaultProp, false);
            }
            #endregion
            //Add <supportedlock> property
            if (((int)(WebDavApplication.Class & WebDavServerClass.Class2)) != 0)
            {
                prop            = PropertyInfo.CreateSupportedLockProperty();
                prop.Calculated = false;
                SetProperty(retVal, prop, false);
            }

            //Add <resourcetype> property
            prop = PropertyInfo.CreateResourceTypeProperty(element);
            SetProperty(retVal, prop, false);

            retVal.ElementInfo = element;
            return(retVal);
        }
Esempio n. 4
0
        /// <summary>
        /// Opens the read.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element)
        {
            if (element == null || element is CollectionInfo)
            {
                return(null);
            }

            Mediachase.Ibn.Data.Meta.FileInfo fileInfo = (Mediachase.Ibn.Data.Meta.FileInfo)element.Tag;
            return(fileInfo.OpenRead());
        }
Esempio n. 5
0
        public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element)
        {
            if (element == null || element is CollectionInfo)
            {
                return(null);
            }

            Mediachase.IBN.Business.EMail.EMailMessageInfo.AttachmentData entry =
                element.Tag as Mediachase.IBN.Business.EMail.EMailMessageInfo.AttachmentData;

            return(new MemoryStream(entry.Data));
        }
Esempio n. 6
0
        public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element)
        {
            if (element == null || element is CollectionInfo)
            {
                return(null);
            }

            object[] param    = (object[])element.Tag;
            MetaFile metaFile = (MetaFile)param[1];

            return(new MemoryStream(metaFile.Buffer));
        }
Esempio n. 7
0
        public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength)
        {
            if (element == null || element is CollectionInfo)
            {
                return(null);
            }

            object[]   param    = (object[])element.Tag;
            MetaFile   metaFile = (MetaFile)param[1];
            MetaObject metaObj  = (MetaObject)param[0];
            MetaDataPlusAbsolutePath absPath = (MetaDataPlusAbsolutePath)param[2];


            return(new MetaFileStream(metaObj, metaFile, absPath.MetaFieldName, contentLength));
        }
Esempio n. 8
0
        /// <summary>
        /// Gets the properties.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public override Mediachase.Net.Wdom.PropertyInfoCollection GetProperties(Mediachase.Net.Wdom.WebDavElementInfo element)
        {
            PropertyInfoCollection retVal = null;
            PropertyInfo           prop   = null;
            WebDavDocument         tmpDoc = WebDavDocument.CreateDocument();

            if (element == null)
            {
                return(retVal);
            }

            retVal = new PropertyInfoCollection();
            //FileInfo fileInfo = !!!!(FileInfo)element.Tag;!!!
            WebDavTicket ticket = WebDavTicket.Parse(element.AbsolutePath);

            WebDavStorageElementPropertiesRow row = GetWebDavStoragePropertyRow(ticket.AbsolutePath.StorageType, ticket.AbsolutePath.UniqueId);

            if (row != null)
            {
                retVal = Mediachase.Ibn.Data.McXmlSerializer.GetObject <PropertyInfoCollection>(row.Value);
            }

            #region CreateDefaultProperties
            foreach (PropertyInfo defaultProp in PropertyInfo.CreateDefaultProperties(element))
            {
                SetPropertyAndSave(retVal, defaultProp, false, false);
            }
            #endregion

            //Add <supportedlock> property
            if (((int)(WebDavApplication.Class & WebDavServerClass.Class2)) != 0)
            {
                prop            = PropertyInfo.CreateSupportedLockProperty();
                prop.Calculated = false;
                SetPropertyAndSave(retVal, prop, false, false);
            }

            //Add <resourcetype> property
            prop = PropertyInfo.CreateResourceTypeProperty(element);
            SetPropertyAndSave(retVal, prop, false, false);

            //Assign context and set closure to class member
            retVal.ElementInfo = element;


            return(retVal);
        }
Esempio n. 9
0
        /// <summary>
        /// Opens the write.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength)
        {
            if (element == null || element is CollectionInfo)
            {
                return(null);
            }

            Mediachase.Ibn.Data.Meta.FileInfo fileInfo = (Mediachase.Ibn.Data.Meta.FileInfo)element.Tag;
            try
            {
                AutoCommitedTransactedStream tranStream = new AutoCommitedTransactedStream(DataContext.Current.BeginTransaction(), contentLength);
                tranStream.InnerStream = fileInfo.OpenWrite();
                tranStream.SetLength(0);

                return(tranStream);
            }
            catch (Exception)
            {
                throw new HttpException(404, "Not Found");
            }
        }
Esempio n. 10
0
 public override void Delete(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Esempio n. 11
0
 public override void Delete(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
Esempio n. 12
0
 public override void CopyTo(Mediachase.Net.Wdom.WebDavElementInfo srcElement, Mediachase.Net.Wdom.WebDavElementInfo destElInfo)
 {
     throw new NotImplementedException();
 }
Esempio n. 13
0
 public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     return(new WebDavElementInfo[] { });
 }
Esempio n. 14
0
 public override void Unlock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken)
 {
     throw new NotImplementedException();
 }
Esempio n. 15
0
 public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
Esempio n. 16
0
 public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength)
 {
     throw new NotImplementedException();
 }
Esempio n. 17
0
 public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
Esempio n. 18
0
        /// <summary>
        /// Locks the specified depth.
        /// </summary>
        /// <param name="depth">The depth.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="lockInfoEl">The lock info el.</param>
        /// <param name="element">The element.</param>
        /// <returns></returns>
        public override OpaqueLockToken Lock(Mediachase.Net.Wdom.DepthValue depth, string timeout, Mediachase.Net.Wdom.LockInfoElement lockInfoEl, Mediachase.Net.Wdom.WebDavElementInfo element)
        {
            ReplaceLockOwner(lockInfoEl);
            PropertyInfoCollection collection = GetProperties(element);

            return(WebDavLockManager.Lock(this, depth, timeout, lockInfoEl, collection));
        }
Esempio n. 19
0
        /// <summary>
        /// Unlocks the specified element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="lockToken">The lock token.</param>
        public override void Unlock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken)
        {
            PropertyInfoCollection collection = GetProperties(element);

            WebDavLockManager.Unlock(this, collection, lockToken);
        }
Esempio n. 20
0
 public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Esempio n. 21
0
 public override void RefreshLock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken, string timeout)
 {
     throw new NotImplementedException();
 }
Esempio n. 22
0
 public override IEnumerable <ActiveLockElement> GetActiveLocks(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
Esempio n. 23
0
        /// <summary>
        /// Refreshes the lock.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="lockToken">The lock token.</param>
        /// <param name="timeout">The timeout.</param>
        public override void RefreshLock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken, string timeout)
        {
            PropertyInfoCollection collection = GetProperties(element);

            WebDavLockManager.RefreshLock(this, collection, lockToken, timeout);
        }
Esempio n. 24
0
 public override void CopyTo(Mediachase.Net.Wdom.WebDavElementInfo srcElement, Mediachase.Net.Wdom.WebDavElementInfo destElInfo)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Esempio n. 25
0
 public override OpaqueLockToken Lock(Mediachase.Net.Wdom.DepthValue depth, string timeout, Mediachase.Net.Wdom.LockInfoElement lockInfoEl, Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }