Normally, PropertyHost (e.g. Entry)'s GetSupportedProperty() return all metadata, resources and actions properties.

However in COFEWS, as each resource occupy a Link in the returned entry object, and each entry list may contains many entry object. If I list all the resource for each entry, it will be too bandwidth consuming, so a new interface named IResourceList is created, which create some folder like structure for what to return in COFEWS.

The parent resource is tagged with ResourceList attribute, with the child resources listed. The child resource is tagged with false in Resource attribute, which means it's minor resource attribute, and wont list in COFEWS entry.

[ResourceList(IconProperties.SmallThumbnail, IconProperties.MediumThumbnail, IconProperties.LargeThumbnail)]
[Resource(MediaType.ResourceList, true)]

/// <summary>
/// Get thumbnail of a image. (128x96).
/// </summary>
[BitmapSize(128, 96)]
[Resource(MediaType.Png, false)]

When user call entry's GetProperty(IconProperties.Thumbnail).Value, they get an object that implements IResourceList. IResourceList is very simple, with a parent resource and child resources.
public interface IResourceList
    /// <summary>
    /// The parent resource property.
    /// </summary>
    object ParentResource { get; }

    /// <summary>
    /// The child resource properties.
    /// </summary>
    IEnumerable<object> Resources { get; }

COFEWS use this to return sub-resources, for examples:

<Entry xmlns:p1="http://cofews" xmlns="http://cofews" p1:ID="0ea8aaf1415c4be9bb0622e33392032d" BaseType="File">
<p1:Time>12/2/2012 9:42:01</p1:Time>
<p1:Link MediaType="application/cofews.entries+xml" Rel="Self" Uri="/entries/{guid}"/>
<p1:Link MediaType="application/cofews.metadata+xml" Rel="Metadata" Uri="/entries/{guid}/metadata"/>
<p1:Link MediaType="application/cofews.entrytype+xml" Rel="TypeInfo" Uri="/entrytypes/6b1b5f17-08b2-65ab-8ee8-96bb73e565d8"/>
<p1:Link MediaType="application/octet-stream" Rel="Download" Uri="/entries/{guid}/stream"/>
*<p1:Link MediaType="application/cofews.resourcelist+xml" Rel="Thumbnail" Uri="/entries/{guid}/thumbnail"/>*

<Resources xmlns:p1="http://cofews" xmlns="http://cofews" p1:Type="thumbnail">
<p1:Link MediaType="image/png" Rel="SmallThumbnail" Uri="/entries/{guid}/smallthumbnail"/>
<p1:Link MediaType="image/png" Rel="LargeThumbnail" Uri="/entries/{guid}/largethumbnail"/>

---> Redirect to /entries/{guid}/largethumbnail, which is png.

---> Redirect to /entries/{guid}/smallthumbnail, which is png.

Last edited Nov 24, 2012 at 9:57 AM by lycj, version 6


No comments yet.