public override ProvisioningTemplate GetTemplate(string uri, string identifier, ITemplateFormatter formatter, ITemplateProviderExtension[] extensions)
        {
            if (String.IsNullOrEmpty(uri))
            {
                throw new ArgumentException("uri");
            }

            if (formatter == null)
            {
                formatter = new JsonPnPFormatter();
                formatter.Initialize(this);
            }

            // Get the XML document from a File Stream
            Stream stream = this.Connector.GetFileStream(uri);

            if (stream == null)
            {
                throw new ApplicationException(string.Format(CoreResources.Provisioning_Formatter_Invalid_Template_URI, uri));
            }

            // Handle any pre-processing extension
            stream = PreProcessGetTemplateExtensions(extensions, stream);

            // And convert it into a ProvisioningTemplate
            ProvisioningTemplate provisioningTemplate = formatter.ToProvisioningTemplate(stream, identifier);

            // Handle any post-processing extension
            provisioningTemplate = PostProcessGetTemplateExtensions(extensions, provisioningTemplate);

            // Store the identifier of this template, is needed for latter save operation
            this.Uri = uri;

            return(provisioningTemplate);
        }
        public override ProvisioningTemplate GetTemplate(string uri, string identifier)
        {
            var formatter = new JsonPnPFormatter();

            formatter.Initialize(this);
            return(this.GetTemplate(uri, identifier, formatter));
        }
        public override List <ProvisioningTemplate> GetTemplates()
        {
            var formatter = new JsonPnPFormatter();

            formatter.Initialize(this);
            return(this.GetTemplates(formatter));
        }
        public override ProvisioningTemplate GetTemplate(Stream stream, string identifier, ITemplateFormatter formatter, ITemplateProviderExtension[] extensions)
        {
            if (stream == null)
            {
                throw new ArgumentException(nameof(stream));
            }

            if (formatter == null)
            {
                formatter = new JsonPnPFormatter();
                formatter.Initialize(this);
            }

            // Handle any pre-processing extension
            stream = PreProcessGetTemplateExtensions(extensions, stream);

            // And convert it into a ProvisioningTemplate
            ProvisioningTemplate provisioningTemplate = formatter.ToProvisioningTemplate(stream, identifier);

            // Handle any post-processing extension
            provisioningTemplate = PostProcessGetTemplateExtensions(extensions, provisioningTemplate);

            // Store the identifier of this template, is needed for latter save operation
            this.Uri = null;

            return(provisioningTemplate);
        }
        public void CanHandleDomainObjectWithJsonFormatter()
        {
            using (Stream _formattedTemplate = new FileStream(this._provisioningTemplatePath7, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                ITemplateFormatter formatter = new JsonPnPFormatter();

                JsonTemplateProvider provider =
                    new JsonFileSystemTemplateProvider(
                        String.Format(@"{0}\..\..\Resources",
                        AppDomain.CurrentDomain.BaseDirectory),
                        "Templates");

                formatter.Initialize(provider);
                var _pt = formatter.ToProvisioningTemplate(_formattedTemplate, "WORKFLOWSITE");

                var _formattedTemplateBack = formatter.ToFormattedTemplate(_pt);

                Assert.IsNotNull(_formattedTemplateBack);
            }
        }
 public override ProvisioningTemplate GetTemplate(string uri, string identifier)
 {
     var formatter = new JsonPnPFormatter();
     formatter.Initialize(this);
     return (this.GetTemplate(uri, identifier, formatter));
 }
 public override List<ProvisioningTemplate> GetTemplates()
 {
     var formatter = new JsonPnPFormatter();
     formatter.Initialize(this);
     return (this.GetTemplates(formatter));
 }
        public override ProvisioningTemplate GetTemplate(string uri, string identifier, ITemplateFormatter formatter, ITemplateProviderExtension[] extensions)
        {
            if (String.IsNullOrEmpty(uri))
            {
                throw new ArgumentException("uri");
            }

            if (formatter == null)
            {
                formatter = new JsonPnPFormatter();
                formatter.Initialize(this);
            }

            // Get the XML document from a File Stream
            Stream stream = this.Connector.GetFileStream(uri);

            if (stream == null)
            {
                throw new ApplicationException(string.Format(CoreResources.Provisioning_Formatter_Invalid_Template_URI, uri));
            }

            // Handle any pre-processing extension
            stream = PreProcessGetTemplateExtensions(extensions, stream);

            // And convert it into a ProvisioningTemplate
            ProvisioningTemplate provisioningTemplate = formatter.ToProvisioningTemplate(stream, identifier);

            // Handle any post-processing extension
            provisioningTemplate = PostProcessGetTemplateExtensions(extensions, provisioningTemplate);

            // Store the identifier of this template, is needed for latter save operation
            this.Uri = uri;

            return (provisioningTemplate);
        }