2013-03-19 17:51:55 -01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
2013-04-03 11:19:10 -02:00
|
|
|
|
using System.Xml.XPath;
|
2013-03-19 17:51:55 -01:00
|
|
|
|
using Umbraco.Core.Models;
|
2013-03-21 08:54:25 -01:00
|
|
|
|
using Umbraco.Core.Xml;
|
2013-03-19 17:51:55 -01:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.PublishedCache
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Provides access to cached contents in a specified context.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
internal abstract class ContextualPublishedCache
|
|
|
|
|
|
{
|
|
|
|
|
|
protected readonly UmbracoContext UmbracoContext;
|
|
|
|
|
|
|
2013-03-31 18:44:29 -02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Initializes a new instance of the <see cref="ContextualPublishedCache"/> with a context.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="umbracoContext">The context.</param>
|
|
|
|
|
|
protected ContextualPublishedCache(UmbracoContext umbracoContext)
|
2013-03-19 17:51:55 -01:00
|
|
|
|
{
|
|
|
|
|
|
UmbracoContext = umbracoContext;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets a content identified by its unique identifier.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="contentId">The content unique identifier.</param>
|
|
|
|
|
|
/// <returns>The content, or null.</returns>
|
2013-03-31 18:44:29 -02:00
|
|
|
|
public abstract IPublishedContent GetById(int contentId);
|
2013-03-19 17:51:55 -01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets contents at root.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>The contents.</returns>
|
2013-03-31 18:44:29 -02:00
|
|
|
|
public abstract IEnumerable<IPublishedContent> GetAtRoot();
|
2013-03-19 17:51:55 -01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets a content resulting from an XPath query.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="xpath">The XPath query.</param>
|
|
|
|
|
|
/// <param name="vars">Optional XPath variables.</param>
|
|
|
|
|
|
/// <returns>The content, or null.</returns>
|
2013-03-21 08:54:25 -01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// <para>If <param name="vars" /> is <c>null</c>, or is empty, or contains only one single
|
|
|
|
|
|
/// value which itself is <c>null</c>, then variables are ignored.</para>
|
|
|
|
|
|
/// <para>The XPath expression should reference variables as <c>$var</c>.</para>
|
|
|
|
|
|
/// </remarks>
|
2013-03-31 18:44:29 -02:00
|
|
|
|
public abstract IPublishedContent GetSingleByXPath(string xpath, params XPathVariable[] vars);
|
2013-03-19 17:51:55 -01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets contents resulting from an XPath query.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="xpath">The XPath query.</param>
|
|
|
|
|
|
/// <param name="vars">Optional XPath variables.</param>
|
|
|
|
|
|
/// <returns>The contents.</returns>
|
2013-03-21 08:54:25 -01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// <para>If <param name="vars" /> is <c>null</c>, or is empty, or contains only one single
|
|
|
|
|
|
/// value which itself is <c>null</c>, then variables are ignored.</para>
|
|
|
|
|
|
/// <para>The XPath expression should reference variables as <c>$var</c>.</para>
|
|
|
|
|
|
/// </remarks>
|
2013-03-31 18:44:29 -02:00
|
|
|
|
public abstract IEnumerable<IPublishedContent> GetByXPath(string xpath, params XPathVariable[] vars);
|
2013-03-20 16:01:49 -01:00
|
|
|
|
|
2013-04-03 11:19:10 -02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets an XPath navigator that can be used to navigate contents.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>The XPath navigator.</returns>
|
2013-03-31 18:44:29 -02:00
|
|
|
|
public abstract XPathNavigator GetXPathNavigator();
|
2013-04-03 11:19:10 -02:00
|
|
|
|
|
2013-03-20 16:01:49 -01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets a value indicating whether the underlying non-contextual cache contains published content.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>A value indicating whether the underlying non-contextual cache contains published content.</returns>
|
2013-03-31 18:44:29 -02:00
|
|
|
|
public abstract bool HasContent();
|
2013-03-19 17:51:55 -01:00
|
|
|
|
}
|
|
|
|
|
|
}
|