Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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());
        }
Ejemplo 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));
        }
Ejemplo 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));
        }
Ejemplo 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));
        }
Ejemplo 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);
        }
Ejemplo 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");
            }
        }
Ejemplo n.º 10
0
 public override void Delete(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 11
0
 public override void Delete(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 12
0
 public override void CopyTo(Mediachase.Net.Wdom.WebDavElementInfo srcElement, Mediachase.Net.Wdom.WebDavElementInfo destElInfo)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 13
0
 public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     return(new WebDavElementInfo[] { });
 }
Ejemplo n.º 14
0
 public override void Unlock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 15
0
 public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 16
0
 public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 17
0
 public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
Ejemplo 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));
        }
Ejemplo 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);
        }
Ejemplo 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.");
 }
Ejemplo n.º 21
0
 public override void RefreshLock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken, string timeout)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 22
0
 public override IEnumerable <ActiveLockElement> GetActiveLocks(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
Ejemplo 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);
        }
Ejemplo 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.");
 }
Ejemplo 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();
 }