diff --git a/src/Umbraco.Core/Services/IPackagingService.cs b/src/Umbraco.Core/Services/IPackagingService.cs
new file mode 100644
index 0000000000..5acaf0fccf
--- /dev/null
+++ b/src/Umbraco.Core/Services/IPackagingService.cs
@@ -0,0 +1,74 @@
+using System.Collections.Generic;
+using System.Xml.Linq;
+using Umbraco.Core.Models;
+
+namespace Umbraco.Core.Services
+{
+ public interface IPackagingService : IService
+ {
+ ///
+ /// Imports and saves package xml as
+ ///
+ /// Xml to import
+ /// Optional parent Id for the content being imported
+ /// Optional Id of the user performing the import
+ /// An enumrable list of generated content
+ IEnumerable ImportContent(XElement element, int parentId = -1, int userId = 0);
+
+ ///
+ /// Imports and saves package xml as
+ ///
+ /// Xml to import
+ /// Optional id of the User performing the operation. Default is zero (admin).
+ /// An enumrable list of generated ContentTypes
+ IEnumerable ImportContentTypes(XElement element, int userId = 0);
+
+ ///
+ /// Imports and saves package xml as
+ ///
+ /// Xml to import
+ /// Boolean indicating whether or not to import the
+ /// Optional id of the User performing the operation. Default is zero (admin).
+ /// An enumrable list of generated ContentTypes
+ IEnumerable ImportContentTypes(XElement element, bool importStructure, int userId = 0);
+
+ ///
+ /// Imports and saves package xml as
+ ///
+ /// Xml to import
+ ///
+ /// An enumrable list of generated DataTypeDefinitions
+ IEnumerable ImportDataTypeDefinitions(XElement element, int userId = 0);
+
+ ///
+ /// Imports and saves package xml as
+ ///
+ /// Xml to import
+ /// Optional user id
+ /// An enumrable list of generated Templates
+ IEnumerable ImportTemplates(XElement element, int userId = 0);
+
+ ///
+ /// Exports an to xml as an
+ ///
+ /// ContentType to export
+ /// containing the xml representation of the ContentType item.
+ XElement Export(IContentType contentType);
+
+ ///
+ /// Exports an item to xml as an
+ ///
+ /// Content to export
+ /// Optional parameter indicating whether to include descendents
+ /// containing the xml representation of the Content object
+ XElement Export(IContent content, bool deep = false);
+
+ ///
+ /// Exports an item to xml as an
+ ///
+ /// Media to export
+ /// Optional parameter indicating whether to include descendents
+ /// containing the xml representation of the Media object
+ XElement Export(IMedia media, bool deep = false);
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs
index fac6906093..e59bb9df7b 100644
--- a/src/Umbraco.Core/Services/PackagingService.cs
+++ b/src/Umbraco.Core/Services/PackagingService.cs
@@ -1,10 +1,8 @@
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
-using System.Threading;
using System.Xml.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
@@ -22,7 +20,7 @@ namespace Umbraco.Core.Services
/// Represents the Packaging Service, which provides import/export functionality for the Core models of the API
/// using xml representation. This is primarily used by the Package functionality.
///
- public class PackagingService : IService
+ public class PackagingService : IPackagingService
{
private readonly IContentService _contentService;
private readonly IContentTypeService _contentTypeService;
@@ -106,7 +104,7 @@ namespace Umbraco.Core.Services
/// Content to export
/// Optional parameter indicating whether to include descendents
/// containing the xml representation of the Content object
- internal XElement Export(IContent content, bool deep = false)
+ public XElement Export(IContent content, bool deep = false)
{
//nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck();
@@ -937,7 +935,7 @@ namespace Umbraco.Core.Services
/// Media to export
/// Optional parameter indicating whether to include descendents
/// containing the xml representation of the Media object
- internal XElement Export(IMedia media, bool deep = false)
+ public XElement Export(IMedia media, bool deep = false)
{
//nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck();
diff --git a/src/Umbraco.Core/Services/ServiceContext.cs b/src/Umbraco.Core/Services/ServiceContext.cs
index 68e09dee38..4bd2f433ba 100644
--- a/src/Umbraco.Core/Services/ServiceContext.cs
+++ b/src/Umbraco.Core/Services/ServiceContext.cs
@@ -21,7 +21,7 @@ namespace Umbraco.Core.Services
private Lazy _dataTypeService;
private Lazy _fileService;
private Lazy _localizationService;
- private Lazy _packagingService;
+ private Lazy _packagingService;
private Lazy _serverRegistrationService;
private Lazy _entityService;
private Lazy _relationService;
@@ -52,7 +52,7 @@ namespace Umbraco.Core.Services
IDataTypeService dataTypeService,
IFileService fileService,
ILocalizationService localizationService,
- PackagingService packagingService,
+ IPackagingService packagingService,
IEntityService entityService,
IRelationService relationService,
ISectionService sectionService,
@@ -66,7 +66,7 @@ namespace Umbraco.Core.Services
_dataTypeService = new Lazy(() => dataTypeService);
_fileService = new Lazy(() => fileService);
_localizationService = new Lazy(() => localizationService);
- _packagingService = new Lazy(() => packagingService);
+ _packagingService = new Lazy(() => packagingService);
_entityService = new Lazy(() => entityService);
_relationService = new Lazy(() => relationService);
_sectionService = new Lazy(() => sectionService);
@@ -129,7 +129,7 @@ namespace Umbraco.Core.Services
_localizationService = new Lazy(() => new LocalizationService(provider, repositoryFactory.Value));
if (_packagingService == null)
- _packagingService = new Lazy(() => new PackagingService(_contentService.Value, _contentTypeService.Value, _mediaService.Value, _dataTypeService.Value, _fileService.Value, _localizationService.Value, repositoryFactory.Value, provider));
+ _packagingService = new Lazy(() => new PackagingService(_contentService.Value, _contentTypeService.Value, _mediaService.Value, _dataTypeService.Value, _fileService.Value, _localizationService.Value, repositoryFactory.Value, provider));
if (_entityService == null)
_entityService = new Lazy(() => new EntityService(provider, repositoryFactory.Value, _contentService.Value, _contentTypeService.Value, _mediaService.Value, _dataTypeService.Value));
@@ -244,7 +244,7 @@ namespace Umbraco.Core.Services
///
/// Gets the
///
- public PackagingService PackagingService
+ public IPackagingService PackagingService
{
get { return _packagingService.Value; }
}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index ff08106d2a..cfb88c8bbd 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -983,6 +983,7 @@
+