Exemple #1
0
        public ApplicationTypeContext(ApplicationManifestType appManifestType, string appPath)
        {
            this.ApplicationManifest = appManifestType;
            this.ServiceManifests    = new Collection <ServiceManifest>();

            this.BuildLayoutSpecification = BuildLayoutSpecification.Create();
            this.BuildLayoutSpecification.SetRoot(appPath);

            this.InitializeAndValidateApplicationParameters(appManifestType.Parameters);
        }
Exemple #2
0
        /// <summary>
        /// Generates checksum files for all service package sub-directories (i.e. code/config/data packages) and service manifests found under the application package root directory.
        /// </summary>
        /// <param name="appPackageRootDirectory">The application package root directory.</param>
        /// <param name="progressHandler">An optional handler for tracking progress of the checksum generation.</param>
        /// <param name="isImageStoreServiceEnabled">Should be set to true if the cluster's ImageStoreConnectionString is set to "fabric:ImageStore", false otherwise.</param>
        /// <remarks>
        /// <para>
        /// The cluster will automatically generate checksums during application type registration if they're not already part of the application package. This method can be used to incur the cost of checksum file generation while preparing the application package, which will reduce the cost of registering the application type package for large packages.
        /// </para>
        /// </remarks>
        public static void GenerateApplicationPackageChecksumFiles(
            string appPackageRootDirectory,
            IImageStoreProgressHandler progressHandler,
            bool isImageStoreServiceEnabled = true)
        {
            var layoutSpecification = BuildLayoutSpecification.Create();

            var files       = new List <string>();
            var directories = new List <string>();

            foreach (var servicePackageDirectory in FabricDirectory.GetDirectories(appPackageRootDirectory))
            {
                files.AddRange(FabricDirectory.GetFiles(servicePackageDirectory));
                directories.AddRange(FabricDirectory.GetDirectories(servicePackageDirectory));
            }

            int completedItems = 0;
            int totalItems     = files.Count + directories.Count;

            foreach (var file in files)
            {
                GenerateChecksumFile(file, layoutSpecification, isImageStoreServiceEnabled);

                try
                {
                    if (progressHandler != null)
                    {
                        progressHandler.UpdateProgress(++completedItems, totalItems, ProgressUnitType.Files);
                    }
                }
                catch (Exception)
                {
                    // Do not fail checksum processing if progress update fails
                }
            }

            foreach (var directory in directories)
            {
                GenerateChecksumFile(directory, layoutSpecification, isImageStoreServiceEnabled);

                try
                {
                    if (progressHandler != null)
                    {
                        progressHandler.UpdateProgress(++completedItems, totalItems, ProgressUnitType.Files);
                    }
                }
                catch (Exception)
                {
                    // Do not fail checksum processing if progress update fails
                }
            }
        }