Click or drag to resize

MultipleDestinationExporter Class

Handles the exporting of a file to multiple destinations that are defined in the config file.
Inheritance Hierarchy
SystemObject
  SystemMarshalByRefObject
    System.ComponentModelComponent
      GSF.IOMultipleDestinationExporter

Namespace: GSF.IO
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
[ToolboxBitmapAttribute(typeof(MultipleDestinationExporter))]
public class MultipleDestinationExporter : Component, 
	ISupportLifecycle, IDisposable, ISupportInitialize, IProvideStatus, IPersistSettings
View Source

The MultipleDestinationExporter type exposes the following members.

Constructors
 NameDescription
Public methodMultipleDestinationExporter Initializes a new instance of the MultipleDestinationExporter class.
Public methodMultipleDestinationExporter(IContainer) Initializes a new instance of the MultipleDestinationExporter class.
Public methodMultipleDestinationExporter(String, Int32) Initializes a new instance of the MultipleDestinationExporter class.
Top
Properties
 NameDescription
Protected propertyCanRaiseEventsGets a value indicating whether the component can raise an event.
(Inherited from Component)
Public propertyContainerGets the IContainer that contains the Component.
(Inherited from Component)
Protected propertyDesignModeGets a value that indicates whether the Component is currently in design mode.
(Inherited from Component)
Public propertyEnabled Gets or sets a boolean value that indicates whether the MultipleDestinationExporter object is currently enabled.
Protected propertyEventsGets the list of event handlers that are attached to this Component.
(Inherited from Component)
Public propertyExportDestinations Gets a list of currently defined ExportDestination.
Public propertyExportTimeout Gets or sets the total allowed time in milliseconds for each export to execute.
Public propertyIsDisposed Gets a flag that indicates whether the object has been disposed.
Public propertyMaximumRetryAttempts Gets or sets the maximum number of retries that will be attempted during an export if the export fails.
Public propertyName Gets the unique identifier of the MultipleDestinationExporter object.
Public propertyPersistSettings Gets or sets a boolean value that indicates whether the settings of MultipleDestinationExporter object are to be saved to the config file.
Public propertyRetryDelayInterval Gets or sets the interval to wait, in milliseconds, before retrying an export if the export fails.
Public propertySettingsCategory 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.
Public propertySiteGets or sets the ISite of the Component.
(Inherited from Component)
Public propertyStatus Gets the descriptive status of the MultipleDestinationExporter object.
Public propertyTextEncoding Gets or sets the Encoding to be used to encode text data being exported.
Public propertyTotalExports Gets the total number exports performed successfully.
Top
Methods
 NameDescription
Public methodBeginInit Performs necessary operations before the MultipleDestinationExporter object properties are initialized.
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject)
Public methodDisposeReleases all resources used by the Component.
(Inherited from Component)
Protected methodDispose(Boolean) Releases the unmanaged resources used by the MultipleDestinationExporter object and optionally releases the managed resources.
(Overrides ComponentDispose(Boolean))
Public methodEndInit Performs necessary operations after the MultipleDestinationExporter object properties are initialized.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodExportData(Byte) Start multiple file export.
Public methodExportData(String) Start multiple file export.
Protected methodFinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.
(Inherited from Component)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Protected methodGetServiceReturns an object that represents a service provided by the Component or by its Container.
(Inherited from Component)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodInitialize Initializes (or reinitializes) MultipleDestinationExporter from configuration settings.
Public methodInitialize(IEnumerableExportDestination) Initializes (or reinitializes) MultipleDestinationExporter from configuration settings.
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Public methodLoadSettings Loads saved settings for the MultipleDestinationExporter object from the config file if the PersistSettings property is set to true.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject)
Protected methodOnInitialized Raises the Initialized event.
Protected methodOnProcessException Raises ProcessException event.
Protected methodOnStatusMessage Raises the StatusMessage event.
Public methodSaveSettings Saves settings for the MultipleDestinationExporter object to the config file if the PersistSettings property is set to true.
Public methodToStringReturns a String containing the name of the Component, if any. This method should not be overridden.
(Inherited from Component)
Top
Events
 NameDescription
Public eventDisposedOccurs when the component is disposed by a call to the Dispose method.
(Inherited from Component)
Public eventInitialized Occurs when the MultipleDestinationExporter object has been initialized.
Public eventProcessException Event is raised when there is an exception encountered while processing.
Public eventStatusMessage Occurs when status information for the MultipleDestinationExporter object is being reported.
Top
Fields
 NameDescription
Public fieldStatic memberDefaultExportTimeout Specifies the default value for the ExportTimeout property.
Public fieldStatic memberDefaultMaximumRetryAttempts Specifies the default value for the MaximumRetryAttempts property.
Public fieldStatic memberDefaultPersistSettings Specifies the default value for the PersistSettings property.
Public fieldStatic memberDefaultRetryDelayInterval Specifies the default value for the RetryDelayInterval property.
Public fieldStatic memberDefaultSettingsCategory Specifies the default value for the SettingsCategory property.
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
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 GSF.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>
  <add name="ExportTimeout" value="-1" description="Total allowed time for all exports to execute in milliseconds."
    encrypted="false" />
  <add name="ExportCount" value="2" description="Total number of export files to produce."
    encrypted="false" />
  <add name="ExportDestination1" value="\\server1\share\" description="Root path for export destination. Use UNC path (\\server\share) with no trailing slash for network shares."
    encrypted="false" />
  <add name="ExportDestination1.ConnectToShare" value="True" description="Set to True to attempt authentication to network share."
    encrypted="false" />
  <add name="ExportDestination1.Domain" value="domain" description="Domain used for authentication to network share (computer name for local accounts)."
    encrypted="false" />
  <add name="ExportDestination1.UserName" value="user1" description="User name used for authentication to network share."
    encrypted="false" />
  <add name="ExportDestination1.Password" value="l2qlAwAPihJjoThH+G53BUxzYsIkTE2yNBHLtd1WA3hysDhwDB82ouJb9n35QtG8"
    description="Encrypted password used for authentication to network share."
    encrypted="true" />
  <add name="ExportDestination1.FileName" value="exportFile.txt" description="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)."
    encrypted="false" />
  <add name="ExportDestination2" value="\\server2\share\" description="Root path for export destination. Use UNC path (\\server\share) with no trailing slash for network shares."
    encrypted="false" />
  <add name="ExportDestination2.ConnectToShare" value="True" description="Set to True to attempt authentication to network share."
    encrypted="false" />
  <add name="ExportDestination2.Domain" value="domain" description="Domain used for authentication to network share (computer name for local accounts)."
    encrypted="false" />
  <add name="ExportDestination2.UserName" value="user2" description="User name used for authentication to network share."
    encrypted="false" />
  <add name="ExportDestination2.Password" value="l2qlAwAPihJjoThH+G53BYT6BXHQr13D6Asdibl0rDmlrgRXvJmCwcP8uvkFRHr9"
    description="Encrypted password used for authentication to network share."
    encrypted="true" />
  <add name="ExportDestination2.FileName" value="exportFile.txt" description="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)."
    encrypted="false" />
</exportDestinations>
See Also