Beispiel #1
0
        public override List <ProvisioningTemplate> GetTemplates()
        {
            var formatter = new JsonPnPFormatter();

            formatter.Initialize(this);
            return(this.GetTemplates(formatter));
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }