Gemstone IO Library
Show/Hide TOC

# MultipleDestinationExporter Class

Handles the exporting of a file to multiple destinations that are defined in the config file.

## Definition

Namespace: IO
Assembly: Gemstone.IO (in Gemstone.IO.dll) Version: 1.0.143 -- Release Build+37d022088aab2458baec8e7580132f50f5d9f39c
C#
View Source Request Example

    public class MultipleDestinationExporter : ISupportLifecycle,
    	IDisposable, IProvideStatus, IPersistSettings, IDefineSettings

VB
View Source Request Example

    Public Class MultipleDestinationExporter
    	Implements ISupportLifecycle, IDisposable, IProvideStatus, IPersistSettings,
    	IDefineSettings

C++
View Source Request Example

    public ref class MultipleDestinationExporter : ISupportLifecycle,
    	IDisposable, IProvideStatus, IPersistSettings, IDefineSettings

JavaScript
View Source Request Example

    Gemstone.IO.MultipleDestinationExporter = function();

    Type.createClass(
    	'Gemstone.IO.MultipleDestinationExporter',
    	null,
    	ISupportLifecycle,
    	IDisposable,
    	IProvideStatus,
    	IPersistSettings,
    	IDefineSettings);

Inheritance
  Object MultipleDestinationExporter

Implements
  IDefineSettings, IPersistSettings, IProvideStatus, ISupportLifecycle, IDisposable

## Remarks

This class is useful for updating the same file on multiple servers (e.g., load balanced web server).

## Example

This example shows the use MultipleDestinationExporter for exporting data to multiple locations:
C#

    using System;
    using Gemstone.IO;

    class Program
    {
        static MultipleDestinationExporter s_exporter;

        static void Main(string[] args)
        {
            s_exporter = new MultipleDestinationExporter();
            s_exporter.Initialized += s_exporter_Initialized;
            ExportDestination[] defaultDestinations = new ExportDestination[]
            {
                new ExportDestination(@"\\server1\share\exportFile.txt", false, "domain", "user1", "password1"),
                new ExportDestination(@"\\server2\share\exportFile.txt", false, "domain", "user2", "password2")
            };
            // Initialize with the destinations where data is to be exported.
            s_exporter.Initialize(defaultDestinations);

            Console.ReadLine();
        }

        static void s_exporter_Initialized(object sender, EventArgs e)
        {
            // Export data to all defined locations after initialization.
            s_exporter.ExportData("TEST DATA");
        }
    }

This example shows the config file entry that can be used to specify the ExportDestination used by the MultipleDestinationExporter when exporting data:
C#

    [ExportDestinations]
    ; Total allowed time for each export to execute, in milliseconds. Set to -1 for no specific timeout.
    ExportTimeout=-1

    ; Maximum number of retries that will be attempted during an export if the export fails. Set to zero to only attempt export once.
    MaximumRetryAttempts=4

    ; Interval to wait, in milliseconds, before retrying an export if the export fails.
    RetryDelayInterval=1000

    ; Total number of export files to produce.
    ExportCount=2

    ; Root path for export destination, e.g., drive letter or UNC share name. Use UNC path (\\server\share) with no trailing slash for network shares.
    ExportDestination1=C:\

    ; Boolean flag that determines whether to attempt network connection to share.
    ExportDestination1_ConnectToShare=false

    ; Path and file name of data export (do not include drive letter or UNC share). Prefix with slash when using UNC paths (\path\filename.txt).
    ExportDestination1_FileName=Path\\FileName.txt

    ; Root path for export destination, e.g., drive letter or UNC share name. Use UNC path (\\server\share) with no trailing slash for network shares.
    ExportDestination2=\\server2\share

    ; Boolean flag that determines whether to attempt network connection to share.
    ExportDestination2_ConnectToShare=True

    ; Domain used for authentication to network share (computer name for local accounts).
    ExportDestination2_Domain=domain

    ; User name used for authentication to network share.
    ExportDestination2_UserName=user2

    ; Password used for authentication to network share. Value supports encryption in the format of "KeyName:EncodedValue".
    ExportDestination2_Password=config-cipher:l2qlAwAPihJjoThH+G53BYT6BXHQr13D6Asdibl0rDmlrgRXvJmCwcP8uvkFRHr9

    ; Path and file name of data export (do not include drive letter or UNC share). Prefix with slash when using UNC paths (\path\filename.txt).
    ExportDestination2_FileName=\\Path\FileName.txt

## Constructors

MultipleDestinationExporter | Initializes a new instance of the MultipleDestinationExporter class.
MultipleDestinationExporter(String, Int32) | Initializes a new instance of the MultipleDestinationExporter class.

## Properties

Enabled | Gets or sets a boolean value that indicates whether the MultipleDestinationExporter object is currently enabled.
ExportDestinations | Gets a list of currently defined ExportDestination.
ExportTimeout | Gets or sets the total allowed time in milliseconds for each export to execute.
IsDisposed | Gets a flag that indicates whether the object has been disposed.
MaximumRetryAttempts | Gets or sets the maximum number of retries that will be attempted during an export if the export fails.
Name | Gets the unique identifier of the MultipleDestinationExporter object.
PersistSettings | Gets or sets a boolean value that indicates whether the settings of MultipleDestinationExporter object are to be saved to the config file.
RetryDelayInterval | Gets or sets the interval to wait, in milliseconds, before retrying an export if the export fails.
SettingsCategory | Gets or sets the category under which the settings of MultipleDestinationExporter object are to be saved to the config file if the PersistSettings property is set to true.
Status | Gets the descriptive status of the MultipleDestinationExporter object.
TextEncoding | Gets or sets the Encoding to be used to encode text data being exported.
TotalExports | Gets the total number exports performed successfully.

## Methods

DefineSettings | Establishes default settings for the config file.
Dispose | Releases all the resources used by the ExportState object.
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object)
ExportData(Byte) | Start multiple file export.
ExportData(String) | Start multiple file export.
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object)
GetHashCode | Serves as the default hash function. (Inherited from Object)
GetType | Gets the Type of the current instance. (Inherited from Object)
Initialize | Initializes (or re-initializes) MultipleDestinationExporter from configuration settings.
Initialize(IEnumerableExportDestination) | Initializes (or re-initializes) MultipleDestinationExporter from configuration settings.
LoadSettings | Loads saved settings from the config file.
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object)
OnInitialized | Raises the Initialized event.
OnProcessException | Raises ProcessException event.
OnStatusMessage | Raises the StatusMessage event.
SaveSettings | Saves settings to the config file.
ToString | Returns a string that represents the current object. (Inherited from Object)

## Events

Disposed | Raised after the source object has been properly disposed.
Initialized | Occurs when the MultipleDestinationExporter object has been initialized.
ProcessException | Event is raised when there is an exception encountered while processing.
StatusMessage | Occurs when status information for the MultipleDestinationExporter object is being reported.

## Fields

DefaultExportTimeout | Specifies the default value for the ExportTimeout property.
DefaultMaximumRetryAttempts | Specifies the default value for the MaximumRetryAttempts property.
DefaultPersistSettings | Specifies the default value for the PersistSettings property.
DefaultRetryDelayInterval | Specifies the default value for the RetryDelayInterval property.
DefaultSettingsCategory | Specifies the default value for the SettingsCategory property.

## See Also

#### Reference

IO
ExportDestination